0

我在以下网站上发现了一些与 ABGroupAddMember 相关的错误:

http://www.iphonedevsdk.com/forum/iphone-sdk-development/65614-issues-abaddressbokk-since-update-ios-4-2-a.html

http://www.3manzana.com/2010/12/bug-no-ios-42-abgroupaddmember.html

有没有其他人看到过这种行为?有什么解决办法吗?

4

1 回答 1

2

我也有同样的经历。这是修复。

解决方案是添加人员(即使该人员已经存在),然后保存通讯录。接下来将该人添加到组中,然后再次保存地址簿。

CFErrorRef err = nil;

//-- add the person to the address book (even if the person already exists)
ABAddressBookAddRecord(abAddressBookRef, person, nil);

//-- save the address book
ABAddressBookSave(abAddressBookRef, &err);

//-- add the person to the group
ABGroupAddMember(abGroupRef, person, &err);

//-- save the address book again
ABAddressBookSave(abAddressBookRef, &err);

应该解决这种性质的大多数问题,因为我在 OS 4.2 之前遇到了其中一些问题,这就是诀窍。

于 2011-03-29T21:06:24.593 回答