iosobjective-ccocoa-touchabrecord

ABAddressBookGetPersonWithRecordID returns NULL when contact has linked contacts


I have no problem getting common contacts (which don't have a linked contact)

but as soon i pick a linked contact using

- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController*)peoplePicker didSelectPerson:(ABRecordRef)person {

and than want to retrive the ABRecordRef

ABRecordRef recordRef = ABAddressBookGetPersonWithRecordID(self.wrapper.ref, recordID.intValue);

i always get null, when the contact is a linked contact


Solution

  • the AB methods are deprecated on iOS9 and in contrary to iOS8 and 7, ABAddressBookGetPersonWithRecordID doesn't work for linked contacts on iOS9 (works on 7-8)

    so the solution is to switch to the CN methods introduced in iOS9