Tutorial :Add an ABPerson to an ABGroup



Question:

I need to create an address book group, then add 10 ABPerson records as group members.

This is what I'm doing:

  1. Create the group with ABGroupCreate()
  2. Use ABGroupAddMember() to add a person to the group

The person record is not getting added. I am saving the address book.

Why doesn't the person get added to the group?


Solution:1

Before a person record can be added to a group, it must already be in the Address Book database. If you need to add a new person record to a group and to the database at the same time, you must first add it to the address book database, save the database, and then add the person record to the group.


Solution:2

You need to do save of group record and save address book before the addmember call


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »