How to fetch unified contacts from ABAddressBook iOS using AddressBook framework but by not using new Contacts Framework ? Is it even possible?

自闭症网瘾萝莉.ら 提交于 2019-12-12 03:57:19

问题


When fetching all the contacts from Addressbook in order to show a custom contacts picker, some contacts are partial. i.e. Same contact may have been synced from facebook or iCloud. So there may be two contacts , one will contain email address and second one contain phone number of same person. How will i make this partially splitted contacts unified into one single contact when fetching all the contacts in addressbook.


回答1:


There is a property :- ABRecordID for getting a unique id for a contact.

For Example:- In your iPhone contacts, there is contact of Mr X like this:-

Mr X

+1 5667-8899

+91 77977 98789

x@gmail.com

x2@gmail.com

So, to uniquely identify all emails or phone numbers belongs to Mr X, ABRecordID is there.

And as per your question whenever you try to fetch all the contacts, once that is done then group the contacts data as per the record id , that is how you will get single contact for multiple phone or emails.

Apple doc:- https://developer.apple.com/library/ios/documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Chapters/DirectInteraction.html



来源:https://stackoverflow.com/questions/35080383/how-to-fetch-unified-contacts-from-abaddressbook-ios-using-addressbook-framework

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!