开发者

ABGroupAddMember returns false. Why?

开发者 https://www.devze.com 2023-04-09 17:53 出处:网络
When I call ABRecordRef aRecord = ABPersonCreate(), ABGroupAddMember()returns YES. But when I use ABNewPersonViewController

When I call ABRecordRef aRecord = ABPersonCreate(), ABGroupAddMember() returns YES.

But when I use ABNewPersonViewController

- (void)newPersonViewController:(ABNewPersonViewController *)new开发者_高级运维PersonViewController didCompleteWithNewPerson:(ABRecordRef)person

And use the (ABRecordRef)person to ABGroupAddMember(), it returns NO.

Why?


Set the addressBook property of the ABNewPersonViewController to the address book reference, which you use to retrieve the group reference.
If you don't set the addressBook property before the ABNewPersonViewController is displayed, then it will create its own address book reference and the ABGroupAddMember function will not work.

0

精彩评论

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

关注公众号