0

On didSelect of CNContachPicker I'm calling one segue but that is not working as when user clicks on any contact didSelect is first called then dismiss. How to handle such scenarios ?

    func contactPicker(_ picker: CNContactPickerViewController, didSelect contact: CNContact) {
            self.performSegue(withIdentifier: "AToB", sender: contact)

}
Nitesh
  • 1,564
  • 2
  • 26
  • 53

1 Answers1

4

Try something like that:

func contactPicker(_ picker: CNContactPickerViewController, didSelect contact: CNContact) {

picker.dismiss(animated:true, completion: {
  self.performSegue(withIdentifier: "AToB", sender: contact)

    })
 }

You should dismiss the ContactPicker first. Use the completion block. When the picker is dismissed and then you can perform any operations. It's just works

Mannopson
  • 2,634
  • 1
  • 16
  • 32