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 has Twitter or Facebook active ? My users have Twitter and Facebook defined in the AB. I can see them there !!
/* The table view controller ViewDidLoad opened the AddressBook and copied these details into addressBookArray then I closed the reference to the AddressBook */
ABRecordRef person = (__bridge ABRecordRef)[addressBookArray objectAtIndex:indexPath.section];
/* Make sure AddressBook is currently open so we can look at things */
ABAddressBookRef addressBook;
addressBook = ABAddressBookCreateWithOptions(NULL, NULL);
if (addressBook != NULL)
{
NSString *firstName = (__bridge_transfer NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
NSString *lastName = (__bridge_transfer NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty);
/* If I don't do this person always returns NULL for social */
ABRecordRef who = ABRecordCopyValue(ABAddressBookGetPersonWithRecordID (addressBook, ABRecordGetRecordID(person));
/* ABMultiValueRef social = ABRecordCopyValue(person, kABPersonSocialProfileProperty); - always returns NULL */
ABMultiValueRef social = ABRecordCopyValue(who, kABPersonSocialProfileProperty); // always returns a value
/* C is always 0 even if user has FB/Twitter etc why ? */
CFIndex c = ABMultiValueGetCount(social);
CFRelease (addressBook);
}
I have read this question:
However, if I edit an AB Contact and actually add twitter I still don't get a result. Is there another way of working this out ? Obviously Apple do it, as the Contacts App tells you about it.