Reputation: 1226
Can anyone please provide me with a few lines of code i can use to add contacts into iphone without using the UI controls.There have been a few answers stating its simplicity but none has mentioned a few steps to do.Thanks
Upvotes: 1
Views: 906
Reputation: 3423
this helper from Erica Sadun will come in very handy
https://github.com/erica/ABContactHelper
Upvotes: 1
Reputation: 135578
ABAddressBookRef addressBook = ABAddressBookCreate();
.ABRecordRef person = ABPersonCreate();
.ABRecordSetValue(person, kABPersonFirstNameProperty, CFSTR("Katie"), &anError);
.ABAddressBookAddRecord()
.ABAddressBookSave()
.CFRelease(addressBook);
.Upvotes: 7