开发者

Possible bug in ABGroupAddMember

I found some bugs related to ABGroupAddMember on following sites:

http://www.iphonedevsdk.com/forum/iphone-sdk-develop开发者_Go百科ment/65614-issues-abaddressbokk-since-update-ios-4-2-a.html

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

Has anyone else seen this behaviour? are there any solutions?


I've experienced the same. Here's the fix.

The solution is to add the person (even if the person already exists), then to save the address book. Next add the person to the group, then save the address book again.

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);

Should solve most issues of this nature, as I experienced some of these issues way before OS 4.2, and this does the trick.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜