gpt4 book ai didi

cocoa - 如何更新: (COCOA/OSX) ABPerson/ABMultiValue (phonenumbers)?

转载 作者:行者123 更新时间:2023-12-03 17:07:05 25 4
gpt4 key购买 nike

II 尝试更改 ABPerson/ABMultiValue(电话号码)的值。

要更新这些吗?

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
}

谢谢!

最佳答案

尝试调用:

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

为您要添加的每个值添加以下内容之一:ABMultiValueAddValueAndLabel(phoneNumbers, value, label, null)

关于cocoa - 如何更新: (COCOA/OSX) ABPerson/ABMultiValue (phonenumbers)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4663122/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com