我也有同样的问题。我找不到答案,所以我只是尝试猜测和检查方法。以下代码似乎有效:
CFErrorRef error = NULL;
ABAddressBookRef iPhoneAddressBook = ABAddressBookCreate();
ABRecordRef newPerson = ABPersonCreate();
ABRecordSetValue(newPerson, kABPersonFirstNameProperty, @"Jane", &error);
ABRecordSetValue(newPerson, kABPersonLastNameProperty, @"Smith", &error);
const CFStringRef customLabel = CFSTR( "mylabel" );
//phone
ABMutableMultiValueRef multiPhone = ABMultiValueCreateMutable(kABMultiStringPropertyType);
ABMultiValueAddValueAndLabel(multiPhone, @"1-444-444-444", kABPersonPhoneMainLabel, NULL);
ABMultiValueAddValueAndLabel(multiPhone, @"1-333-333-333", kABPersonPhoneMobileLabel, NULL);
ABMultiValueAddValueAndLabel(multiPhone, @"1-666-666-666", kABOtherLabel, NULL);
ABMultiValueAddValueAndLabel(multiPhone, @"1-555-555-555", customLabel, NULL);
ABRecordSetValue(newPerson, kABPersonPhoneProperty, multiPhone,nil);
CFRelease(multiPhone);
ABAddressBookAddRecord(iPhoneAddressBook, newPerson, &error);
ABAddressBookSave(iPhoneAddressBook, &error);
if (error != NULL)
{
NSLog(@"Error!");
}
如果您检查地址簿,您将看到带有自定义标签的电话号码:mylabel
谢谢:这个帖子 https://stackoverflow.com/questions/2404975/what-are-the-tags-around-default-iphone-address-book-people-phone-number-labels
And to: 这个博客 http://www.modelmetrics.com/tomgersic/iphone-programming-adding-a-contact-to-the-iphone-address-book/