Hi, everyone,
I want to ask a question about the iPhone Contacts and objective-C. I want to create a contacts in my program and add to the iPhone. I write the following code, the first name, last name and phone number is good, but I cannot add the email to the contacts. Can anyone help me?
record = ABPersonCreate(); ABAddressBookRef addressBook = ABAddressBookCreate();
// add the content number
ABMutableMultiValueRef phoneNumber = ABMultiValueCreateMutable(kABMultiStringPropertyType);
ABMultiValueAddValueAndLabel(phoneNumber, addPhoneNumber, kABPersonPhoneMobileLabel, NULL);
// The type of the addXXX is NSString *
ABRecordSetValue(record, kABPersonFirstNameProperty, addFirstName, NULL);
ABRecordSetValue(record, kABPersonLastNameProperty, addSecondName, NULL);
ABRecordSetValue(record, kABPersonPhoneProperty, addPhoneNumber, NULL);
ABRecordSetValue(record, kABPersonEmailProperty, addEmail, NULL); // <-- problem in here !!
ABAddressBookAddRecord(addressBook, record, NULL);
ABAddressBookSave(addressBook, NULL);