【问题标题】:iOS: CNContactPicker didSelect - How to determine the type of property selected?iOS:CNContactPicker didSelect - 如何确定所选属性的类型?
【发布时间】:2017-03-04 19:29:51
【问题描述】:

我正在尝试通过检查传递给联系人选择器完成的协议函数的 CNContactProperty 来检测用户在与 CNContactPickerViewController 交互时选择的属性类型。

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”语句不起作用。知道为什么吗?

如何确定用户从联系人选择器屏幕中选择的属性类型?

【问题讨论】:

    标签: ios swift xcode properties cncontactpicker


    【解决方案1】:

    解决方案:

    if theContactProperty.key == CNContactPhoneNumbersKey {
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多