Hi, In the iphone app,I've a form with details such as name,address. I need to save the name,address in the form to the iPhone AddressBook.Please someone help me how to do this.
Thanks in advance.
Hi, In the iphone app,I've a form with details such as name,address. I need to save the name,address in the form to the iPhone AddressBook.Please someone help me how to do this.
Thanks in advance.
ABAddressBookRef addressBook = ABAddressBookCreate();
ABRecordRef person = ABPersonCreate();
CFErrorRef error;
if (!ABRecordSetValue(person, kABPersonFirstNameProperty, @"John", &error))
{
// error
}
if (!ABRecordSetValue(person, kABPersonLastNameProperty, @"Smith", &error))
{
// error
}
if (!ABAddressBookAddRecord(addressBook, person, &error))
{
// error
}
if (!ABAddressBookSave(addressBook, &error))
{
// eror
}
You can set other properties with other kABxx
constants.