Question

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!

Was it helpful?

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top