当前位置: 动力学知识库 > 问答 > 编程问答 >

How to update: (COCOA/OSX) ABPerson / ABMultiValue (phonenumbers)?

问题描述:

II trying to change the value of ABPerson / ABMultiValue (the phone numbers).

Anyway to update these?

ABAddressBook *ab = [ABAddressBook sharedAddressBook];

NSArray *persons = [ab people];

int j=[persons count];

for (int i=0; i<j; i++) {

ABPerson *person = [persons objectAtIndex:i];

ABMultiValue *phonenumbers = [person valueForProperty:kABPhoneProperty];

// update here *phonenumbers

}

Thanks!

网友答案:

Try calling:

ABMultiValueRef phoneNumbers = ABMultiValueCreateMutable(kABPersonPhoneProperty);
ABMultiValueAddValueAndLabel(phoneNumbers, value, label, null);
ABRecordSetValue(person, kABPersonPhoneProperty, phoneNumbers, NULL);

Add one of these: ABMultiValueAddValueAndLabel(phoneNumbers, value, label, null) for every value you want to add.

分享给朋友:
您可能感兴趣的文章:
随机阅读: