You want to create a new person contact and insert it into the user’s address book.
ABPersonCreate function to create a new
person. Set the person’s properties using the
ABRecordSetValue function, and add the person to the address book using the
After accessing the address book database using the
ABAddressBookCreate function, you can start
inserting new group and person records into the database. In this
recipe, we will concentrate on inserting new person records. For
information about inserting new groups into the address book, please
refer to Recipe 13.6.
to create a new person record. Bear in mind that calling this function
is not enough to add the person record to the address book. You must
save the address book for your record to appear in the database.
By calling the
function, you get a Core Foundation reference to a value of type
ABRecordRef. Now you can call the
ABRecordSetValue function to set the
various properties of a new person entry. Once you are done, you must
add the new person record to the database. You can do this using the
After doing this, you must also save any unsaved changes to the address
book database in order to truly preserve your new person record.
Do this by using the
So let’s combine all of this into a method that allows us to insert ...