I am using Contacts framework in an app. the thing I'm trying to do is categorize all the contacts by their containers. e.g. facebook contacts will be under the title "Facebook", google contacts under "Google". But when I print the names of the containers sometimes it comes empty or null or something vague, like "Address Book". Is there any way to find out which container belongs to which account(local, facebook, google etc). Thanks in advance.
CNContactStore *contactStore = [[CNContactStore alloc]init];
NSArray *keysToFetch = @[CNContactGivenNameKey,CNContactFamilyNameKey,CNContactIdentifierKey,CNContactMiddleNameKey,CNContactPhoneNumbersKey];
NSError *error;
NSArray *containers = [contactStore containersMatchingPredicate:nil error:&error];
for (CNContainer *container in containers) {
NSLog(@"Container: %@",container.name);
}