Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the ABRecordID from newly added Address Book Object ios

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!

like image 247
Tommy Nicholas Avatar asked Jul 27 '13 22:07

Tommy Nicholas


1 Answers

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

like image 112
omz Avatar answered Oct 18 '22 17:10

omz