Get ABRecordID from a newly added ios address book object

I have an application that adds Contacts to the address book in iOS, and all I need to do is save ABRecordID or ABRecordref as soon as I save the contact.

ABAddressBookAddRecord(addressbook, newPerson, &theerror); ABAddressBookSave(addressbook, &theerror); 

This question is very similar, but I do not understand the answer: ABRecordID for an entry in the address book (unique identifier for the inserted record in the address book)

How do you know

 ABRecordID ABRecordGetRecordID ( ABRecordRef newPerson ); 

Some help here would be fantastic - thanks!

+8
ios addressbook
source share
1 answer

Just call ABRecordGetRecordID(newPerson) after you save the address book (before that there will be no valid identifier).

 //... ABRecordID recordID = ABRecordGetRecordID(newPerson); 

An ABRecordID matches int_32 (32-bit integer).

+19
source share

All Articles