如何使用ABAddressBook删除iPhone通讯录中的记录?
我正在学习地址簿框架,然后我想从iPhone通讯录中删除记录。我检查了文档,发现了一个名为 ABAddressBookRemoveRecord
的函数,但我找不到删除记录的方法,就像用户选择一条记录,然后单击删除按钮,然后单击该记录一样将会被删除。
到目前为止我所做的就是把头撞在文档上,仅此而已。
您能给我提供一个链接或示例如何删除地址簿中的记录吗?
谢谢你!
I was learning the addressbook framework and then I wanted to delete the record from the the iPhone contact book. I checked up the documentation and found a function called ABAddressBookRemoveRecord
, but I can't find out a way to delete the records, like the user will select a record and then hit the delete button and then the record will get deleted.
All I did till now is banged my head over the documentation and that's all.
Can you please provide me a link or an example how to delete a record in the address book?
Thank You!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查看 ABPersonViewController+Delete 类别,该类别无需使用任何私有方法即可删除联系人:
https://github.com/shrtlist/ AB删除
Check out the ABPersonViewController+Delete category which enables contact deletion without using any private methods:
https://github.com/shrtlist/ABDelete
当您通过
ABAddressBookRemoveRecord
删除记录时,您应该通过ABAddressBookSave
保存最终结果。如果你想要一个UIInterface来删除记录,我认为你需要自己实现。苹果提供的联系人UI位于ABAddressBookUI框架内。When you delete a record by
ABAddressBookRemoveRecord
, you should save the final result byABAddressBookSave
. If you want a UIInterface to delete the record, I think you need to implement by yourself. The UIs about contacts provided by apple are inside theABAddressBookUI framework
.Objective C 代码:
Swift 代码:
Objective C code:
Swift Code: