ABAddressBook 没有名为“removeRecord”的成员
Posted
技术标签:
【中文标题】ABAddressBook 没有名为“removeRecord”的成员【英文标题】:ABAddressBook does not have a member named 'removeRecord' 【发布时间】:2014-11-10 00:09:19 【问题描述】:为了帮助别人,我发现Apple的ios文档是错误的,XCode 6.1不支持removeRecord方法,导致标题错误
这不起作用
var adbk: ABAddressBook! //then assign it in some other code
var newContact: ABRecord //then create it in some other code
var success:Bool = adbk.removeRecord(newContact) //this does not work - results in the title error
这是在 Swift 中从通讯录中删除记录的解决方案:
var adbk: ABAddressBook! //then assign it in some other code
var newContact: ABRecord //then create it in some other code
var error: Unmanaged<CFErrorRef>? = nil
var success = ABAddressBookRemoveRecord(adbk, newContact, &error)
不正确的参考指南: https://developer.apple.com/library/mac/Documentation/UserExperience/Reference/AddressBook/Classes/ABAddressBook_Class/index.html#//apple_ref/occ/instm/ABAddressBook/addRecord:
【问题讨论】:
【参考方案1】:这是在 Swift 中从通讯录中删除记录的解决方案:
var adbk: ABAddressBook! //then assign it in some other code
var newContact: ABRecord //then create it in some other code
var error: Unmanaged<CFErrorRef>? = nil
var success = ABAddressBookRemoveRecord(adbk, newContact, &error)
【讨论】:
以上是关于ABAddressBook 没有名为“removeRecord”的成员的主要内容,如果未能解决你的问题,请参考以下文章
错误:命名空间“std”中没有名为“remove_cv_t”的模板;你是说'remove_cv'吗?
自动化测试 ABAddressBook 和 ALAssetsLibrary 请求访问