Skip to content

iPhone: add contacts to the address book

From: Add entry to contacts using iPhone SDK « Mr. Rask

This is what the code looks like:

ABAddressBookRef addressBook = ABAddressBookCreate();
ABRecordRef person = ABPersonCreate();


ABRecordSetValue(person, kABPersonFirstNameProperty, @”Kate” , nil);
ABRecordSetValue(person, kABPersonLastNameProperty, @”Hutson”, nil);
ABAddressBookAddRecord(addressBook, person, nil);
ABAddressBookSave(addressBook, nil);

CFRelease(person);