올바른 것을 얻었습니다.
보유한 유일한 그룹은 "제목 없음 그룹"입니다. "모든 iCloud"는 ABGroup이 아니지만 이 아닌 모든 연락처에는이 그룹으로 설정되어 있습니다.
같은 UI를 복제하려는 경우, 당신은 다음을 수행 할 수
// get your addressbook reference first
// Create mutable dictionary for holding
NSMutableDictionary *sourceDisplayDictionary = [NSMutableDictionary dictionary];
NSArray *sources = (__bridge NSArray *)(ABAddressBookCopyArrayOfAllSources(addressbook));
// Cannot use "ABRecordRef" in fast enumeration
for (id source in sources) {
ABRecordRef sourceRef = (__bridge ABRecordRef)(source);
NSString *sourceName = (__bridge NSString *)(ABRecordCopyValue(sourceRef, kABSourceNameProperty));
// The "All" groups aren't real groups, they're placeholders for ABPersons without a group
NSString *beginningGroup = [@"All " stringByAppendingString:sourceName];
NSMutableArray *groupNames = [NSMutableArray arrayWithObject:beginningGroup];
NSArray *groups = (__bridge NSArray *)(ABAddressBookCopyArrayOfAllGroupsInSource(addressbook, sourceRef));
// Again, iterate over the array of groups _inside_ the source to build the subarray array
for (id group in groups) {
ABRecordRef groupRef = (__bridge ABRecordRef)(group);
NSString *groupName = (__bridge NSString *)(ABRecordCopyValue(groupRef, kABGroupNameProperty));
[groupNames addObject:groupName];
}
// Add the source name to the dictionary
sourceDisplayDictionary[sourceName] = [groupNames copy];
}
NSDictionary *sourceDictionary = [sourceDisplayDictionary copy];
/*
{
"iCloud":
[
"All iCloud",
"untitled group"
]
}
*/
을
출처
2015-12-02 20:05:11
Tim