我正在使用 CNContactPickerViewController 让用户选择他/她的联系人之一的电子邮件
let contactPicker = CNContactPickerViewController()
contactPicker.delegate = self
contactPicker.predicateForSelectionOfContact = NSPredicate(format: "emailAddresses.@count > 0")
contactPicker.displayedPropertyKeys = [CNContactNicknameKey, CNContactEmailAddressesKey]
当联系人只有一封邮件时,一切顺利
func contactPicker(_ picker: CNContactPickerViewController, didSelect contact: CNContact) {
if let _mail = contact.emailAddresses.first?.value as String? {
self.personWasSelected(with: _mail)
}
}
但有时其中一个联系人有不止一封邮件,我怎样才能让用户选择其中之一?