Get the ABRecordID from newly added Address Book Object ios

addressbook, ios

Solution

Simply call `ABRecordGetRecordID(newPerson)` after you've saved the address book (before that, there won't be a valid ID).

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

An `ABRecordID` is the same as an `int_32` (a 32-bit integer).

Problem

I have an application that adds Contacts to the Address Book in iOS, and all I need is to store the ABRecordID or ABRecordref as soon as I save the contact. ``` ABAddressBookAddRecord(addressbook, newPerson, &theerror); ABAddressBookSave(addressbook, &theerror); ``` This question is extremely similar, but I don't understand the answer: ABRecordID for a record in addressbook(unique id for inserted record in addressbook) How do you know the ``` ABRecordID ABRecordGetRecordID ( ABRecordRef newPerson ); ``` Some help here would be fantastic - thanks!

Original source