下記のデリゲートコールバックで選択したメールプロパティを取得しようとしています
-(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;
}
しかし、リンクされた連絡先の電子メール プロパティ (単一の電子メールを持っている) を選択すると、識別子が 0 として取得され、その結果、主要な連絡先の最初の電子メール ID が取得されます。例: ジョン - john@gmail.com john26@gmail.com ロジャー (リンクされた連絡先) - roger@gmail.com
roger@gmail.com を選択すると、john@gmail.com が表示されます。