How to get Group Name of a particular contact

Viewed 184

I am trying to get Group Name of a particular contact. I tried following code

CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFIndex nPeople= ABAddressBookGetPersonCount(addressBook);
NSUInteger peopleCounter = 0;
for (peopleCounter = 0;peopleCounter < nPeople; peopleCounter++)
{
    ABRecordRef thisPerson = CFArrayGetValueAtIndex(allPeople,peopleCounter);
    NSString *strGroupName  = (__bridge NSString *)(ABRecordCopyValue(thisPerson, kABGroupNameProperty));
}

But all it does is return the first name of a contact in strGroupName.

0 Answers
Related