0
我想通过检查传递给协议功能的CNContactProperty完成联系人选择器来检测用户在与CNContactPickerViewController进行交互时选择了何种类型的属性。iOS:CNContactPicker didSelect - 如何确定所选属性的类型?
IE。告诉用户是否选择了电话号码或电子邮件等。
public func contactPicker(_ picker: CNContactPickerViewController, didSelect theContactProperty: CNContactProperty){
if theContactProperty. == CNContactPhoneNumbersKey { // This doesn't work!!
// Do stuff when we've received a phone number
}
else {
// Do other stuff when we have received something other than a phone number
}
}
上面使用的“if”语句不起作用。任何想法为什么?
如何确定用户从联系人选择器屏幕中选择的属性类型?