开发者

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

开发者 https://www.devze.com 2023-02-04 17:58 出处:网络
II trying to change the value of ABPerson / ABMultiValue (the phone numbers). Anyway to update these?

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 obj开发者_开发技巧ectAtIndex: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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号