Hi can anyone tell me why ABMultiValueGetCount(social) always returns 0 count ? All other fields return from the address book perfectly.
I\'m trying to see if contact
Alright, made some progress ....
Seems this property does work kABPersonInstantMessageProperty.
Sharing what I've done so far, as this seems to stump so many users. At least this code can be used as a basis to see if you have Skype, Yahoo, Facebook etc ..... but I want to get the FBID and that's held under kABPersonSocialProfileProperty. Why doesn't kABPersonSocialProfileProperty work as well as kABPersonInstantMessageProperty ? Is it an iOS 6 issue ....
*No it appears that unless you manually go to Settings - Facebook - Update All Contacts on your iOS device, the AddressBook has no knowledge for kABPersonSocialProfileProperty. Why is Apple inconsistent with the two properties ? In addition you have to select the linked contact that was created as the main contact also does not hold these details !!*
Also, why do I have to assign 'who' and can't use 'person' natively ?
Any one else got any more ideas ?
/* person is of type ABRecordRef loaded from an array thus:
addressBookArray = (__bridge_transfer NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook);
.....
person = (__bridge ABRecordRef)[addressBookArray objectAtIndex:indexPath.section];
*/
ABAddressBookRef addressBook;
addressBook = ABAddressBookCreateWithOptions(NULL, NULL);
if (addressBook != Nil)
{
int howManySocialApps;
ABRecordRef who = ABAddressBookGetPersonWithRecordID (addressBook, ABRecordGetRecordID(person));
NSArray *linkedPeople = (__bridge_transfer NSArray *)ABPersonCopyArrayOfAllLinkedPeople (who);
for (int x = 0; x < [linkedPeople count]; x++)
{
ABMultiValueRef socialApps = ABRecordCopyValue((__bridge ABRecordRef)[linkedPeople objectAtIndex:x], kABPersonSocialProfileProperty);
CFIndex thisSocialAppCount = ABMultiValueGetCount(socialApps);
for (int i = 0; i < thisSocialAppCount; i++)
{
NSDictionary *socialItem = (__bridge_transfer NSDictionary*)ABMultiValueCopyValueAtIndex(socialApps, i);
NSLog(@"Social Item of type %@", [socialItem objectForKey:(NSString *)kABPersonSocialProfileServiceKey]);
}
if (socialApps != Nil)
CFRelease(socialApps);
howManySocialApps += thisSocialAppCount;
}
NSLog (@"Number of SocialApps Found is %i", howManySocialApps);
CFRelease(addressBook);
}