我试图做的,是让所有的联系和依赖,如果接触有SocialProfileProperty与否,之后得到这一切的联系人有SocialProfileProperty我将简单的过滤知道它是Facebook,微博,..
在我发布这个问题我西整天试图寻找这个问题的任何解决方案?
但它允许返回0?
ABAddressBookRef addressBook;
CFErrorRef *erer = NULL;
addressBook = ABAddressBookCreateWithOptions(NULL, erer);
CFArrayRef _allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFIndex _nPeople = ABAddressBookGetPersonCount(addressBook);
NSMutableArray *socialArray = [[NSMutableArray alloc] init];
ABMultiValueRef socialProfiles;
for (int i=0;i<_nPeople; i++) {
ABRecordRef _person=CFArrayGetValueAtIndex( _allPeople,i);
NSNumber *recordId = [NSNumber numberWithInteger:ABRecordGetRecordID(_person)];
NSLog(@"%@",recordId);
socialProfiles = ABRecordCopyValue(_person, kABPersonSocialProfileProperty);
if (ABMultiValueGetCount(socialProfiles)>0) {
[socialArray addObject:(__bridge id)(socialProfiles)];
}
}
NSLog(@"%d",socialArray.count);