I am trying to fetch selected email property in delegate callback mentioned below
-(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier {
if (property==kABPersonEmailProperty) {
ABMultiValueRef emails = ABRecordCopyValue(person, kABPersonEmailProperty);
if (ABMultiValueGetCount(emails) > 0) {
NSString *email = (__bridge_transfer NSString*)
ABMultiValueCopyValueAtIndex(emails, ABMultiValueGetIndexForIdentifier(emails,identifier));
[recipientEmail setText:email];
[peoplePicker dismissViewControllerAnimated:YES completion:nil];
}
CFRelease(emails);
}
return NO;
}
But If I select the email property of linked contact (Having single email) I get the identifier as 0, as a result I get the first email-id of primary contact. Eg: John - john@gmail.com john26@gmail.com Roger (Linked Contact) - roger@gmail.com
When I select roger@gmail.com I get john@gmail.com.