如何使用AddressBook框架但不使用新的Contacts Framework从ABAddressBook iOS获取统一联系人?可能吗 [英] How to fetch unified contacts from ABAddressBook iOS using AddressBook framework but by not using new Contacts Framework ? Is it even possible?
问题描述
从通讯录中获取所有联系人以显示自定义联系人选择器时,某些联系人是不完整的。即同一联系人可能已从Facebook或iCloud同步。因此,可能有两个联系人,一个包含电子邮件地址,第二个包含同一个人的电话号码。在地址簿中获取所有联系人时,如何将这种部分拆分的联系人统一为一个联系人。
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.
推荐答案
有一个属性:- ABRecordID
用于获取联系人的唯一ID。
There is a property :- ABRecordID
for getting a unique id for a contact.
例如:-
在您的iPhone联系人中,有X先生这样的联系人:-
For Example:- In your iPhone contacts, there is contact of Mr X like this:-
先生X
+1 5667-8899
+1 5667-8899
+91 77977 98789
+91 77977 98789
x@gmail.com
x@gmail.com
x2@gmail.com
x2@gmail.com
因此,要唯一标识X先生所有的电子邮件或电话号码,请使用ABRecordID。
So, to uniquely identify all emails or phone numbers belongs to Mr X, ABRecordID is there.
根据您的问题,每当您尝试获取时所有联系人完成后,然后根据记录id对联系人数据进行分组,这就是您将如何为多个电话或电子邮件获得单个联系人的方式。
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
这篇关于如何使用AddressBook框架但不使用新的Contacts Framework从ABAddressBook iOS获取统一联系人?可能吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!