目前我正在使用此代码片段从 iPhone 获取联系人
CNContactStore *store = [[CNContactStore alloc] init];
[store requestAccessForEntityType:CNEntityTypeContacts completionHandler:^(BOOL granted, NSError * _Nullable error) {
if (granted == YES) {
//keys with fetching properties
NSArray *keys = @[CNContactGivenNameKey,CNContactFamilyNameKey, CNContactPhoneNumbersKey, CNContactImageDataKey];
[[CNContactsUserDefaults sharedDefaults] sortOrder];
NSString *containerId = store.defaultContainerIdentifier;
//NSComparator hg= [CNContact comparatorForNameSortOrder:CNContactSortOrderGivenName];
NSPredicate *predicate = [CNContact predicateForContactsInContainerWithIdentifier:containerId];
NSError *error;
NSArray *cnContacts = [store unifiedContactsMatchingPredicate:predicate keysToFetch:keys error:&error];
NSSortDescriptor *sortDescriptor;
sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"givenName"
ascending:YES];
NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
NSArray *sortedArray = [cnContacts sortedArrayUsingDescriptors:sortDescriptors];
}];
但在这里我只从 iCloud 获取联系人。
我如何从 Facebook、gmail 或任何其他云获得联系? 请帮助考虑这一点。