I'm getting this error when trying to open the "Contacts" app view within my app for selecting and importing contacts. I'm not sure what the issue is. Can someone help solve the problem?
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController openContacts:]: unrecognized selector sent to instance 0x7ff917a10740'
Here's my code
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)
}
}