CNContactPickerViewController doesn't display detail for selected contact

I’m attempting to use the iOS 9 CNContactPickerViewController in my app. I get the initial picker screen to be displayed listing my contacts. However, upon selecting a contact (with multiple addresses) I do not get the detail screen for that contact to be displayed (so I can select a single address). Instead my CNContactPickerDelegate method is called. How do I get the detail screen to be displayed?


This is the CNContactPickerDelegate method that is called when I select a contact:


- (void)contactPicker:(CNContactPickerViewController *)picker didSelectContact:(CNContact *)contact

{

NSLog(@"you selected %@", contact);

}

It seems implementing contactPicker:didSelectContact: means we need to implement all the behaviors on a contact selected.

Try removing the method.

In theory, you would use the predicateForSelectionOfContact and predicateForSelectionOfProperty properites:

        let cpvc: CNContactPickerViewController = CNContactPickerViewController()
        cpvc.delegate = self
        cpvc.predicateForSelectionOfContact = NSPredicate(value: false)  //show detail card for all contacts when tapped
        cpvc.predicateForSelectionOfProperty = NSPredicate(value: true)  //call delegate method for all properties when tapped

When a contact property is tapped, the CNContactPickerDelegate method -contactPicker:DidSelectContactProperty should be called. However, there is a bug in iOS 9 beta, and that delegate method is not called, and the contact detail is not closed (sometimes I'm seeing it go blank after a few seconds).


My workaround is to just let CNContactPickerViewController select the contact (i.e., don't set predicateForSelectionOfContact), get the contact in contactPicker:didSelectContact, and present the list of contact properties in my own table view controller that the user can select from.


I've filed a bug report #21569949, which is closed as a duplicate of #21165461, which is still open. Actually I noticed this with CNContactViewController, but I'm pretty sure it is the same bug (i.e. CNContactPickerViewController is showing a CNContactViewController for the selected contact, and the bug is in CNContactViewController).

Thank you for your input. Rather than implement my own table view controller to display a contact's multiple addresses I will just stick with the iOS 8 method using the AddressBook framework and wait until Apple fixes this bug in the new Contacts framework in iOS 9.

CNContactPickerViewController doesn't display detail for selected contact
 
 
Q