2010-04-20 26 views

cevap

11

Ben de aynı sorularım vardı. Bir cevap bulamadım, bu yüzden tahmin ve kontrol yöntemini denedim. için

Teşekkür mylabel: this post

Ve etmek: this blog

adres defteri kontrol ederseniz, bir telefon özel bir etiket ile numarayı göreceksiniz

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!"); 
} 

: Aşağıdaki kod iş gibi görünüyor

+0

Benim için iyi çalışıyor, çok teşekkürler! – Will

İlgili konular