I’m adding a contact to the address book, so far it just contains the name and phone number.
The contact appears in the address book when I go to view it but the phone number isn’t present.
ABAddressBookRef adbk = ABAddressBookCreate();
ABRecordRef contact = ABPersonCreate();
CFErrorRef error = nil;
BOOL success = ABRecordSetValue(contact, kABPersonFirstNameProperty, @"f name", &error);
ABMutableMultiValueRef phone = ABMultiValueCreateMutable(kABMultiStringPropertyType);
success = ABMultiValueAddValueAndLabel(phone, @"123456789",kABPersonPhoneMainLabel, nil);
CFRelease(phone);
success = ABAddressBookAddRecord(adbk, contact, &error);
success = ABAddressBookSave(adbk, &error);
CFRelease(contact);
CFRelease(adbk);
Tried replacing kABPersonPhoneMainLabel with for example kABPersonPhoneMobileLabel but it makes no difference.
Why is the name appearing but not the phone number?
Every function returns YES.
Looks like your forgetting to call ABRecordSetValue with the phone number. See snippet below.