尝试在我的应用中打开“联系人”应用视图以选择和导入联系人时出现此错误。我不确定是什么问题。有人可以帮助解决问题吗?
***由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [UIViewController openContacts:]:无法识别的选择器发送到实例0x7ff917a10740'
let contact = CNMutableContact()
var delegate: ViewSevenFiveDelegate!
var tableViewController: ViewTwo? = nil
//Fetch Contacts Information like givenName and familyName, phoneNo, address
let keysToFetch = [CNContactGivenNameKey, CNContactFamilyNameKey, CNContactPhoneNumbersKey]
let store = CNContactStore()
@IBAction func openContacts(sender: AnyObject) {
//open contacts to add to VCtable
let contactPickerViewController = CNContactPickerViewController()
contactPickerViewController.predicateForEnablingContact = NSPredicate(format: "Number != nil")
contactPickerViewController.displayedPropertyKeys = [CNContactGivenNameKey, CNContactFamilyNameKey, CNContactPhoneNumbersKey]
contactPickerViewController.delegate = self
presentViewController(contactPickerViewController, animated: true, completion: nil)
}
func contactPicker(picker: CNContactPickerViewController, didSelectContact contact: CNContact) {
delegate.didFetchContacts([contact])
navigationController?.popViewControllerAnimated(true)
}
}