How to get ABRecordRef from ABRecordID?

纵饮孤独 提交于 2019-12-12 10:36:23

问题


I have accessed the address book and success fully extracted the records and necessary info from it. I have also extracted recordid. My problem is how to use this recordid to extract record later. The code which I am using is:

ABRecordID recordId;
ABAddressBookRef _addressBookRef = ABAddressBookCreate ();
NSArray* allPeople = (NSArray *)ABAddressBookCopyArrayOfAllPeople(_addressBookRef);

for (id record in allPeople) {
    recordId = ABRecordGetRecordID(record);

    //i am saving each one  how to use them later to extract particular record
}

回答1:


Obviously, the results of ABAddressBookCopyArrayOfAllPeople is an array of ABPersonRef, which you then individually use to get your ABRecordID. If at some later point, you want to take your recordId to retrieve the ABPersonRef, you use ABAddressBookGetPersonWithRecordID.



来源:https://stackoverflow.com/questions/14055438/how-to-get-abrecordref-from-abrecordid

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