CNContactPickerViewController ignores `predicateForSelectionOfContact` when searching

Originator:bryan
Number:rdar://28084632 Date Originated:08/30/2016
Status:Open Resolved:No
Product:iOS SDK Product Version:9.X
Classification:Serious Bug Reproducible:Yes
 
Summary:

I am trying to present `CNContactPickerViewController` instances that can only be used for selecting contacts, _not_ properties of contacts. I’ve been able to mostly accomplish this by setting `predicateForSelectionOfContact = NSPredicate(value: true)` on my view controller instances, but this value often does not seem to be respected while searching.

For the remainder of this write-up, I will refer to a `CNContactPickerViewController` instance whose delegate implements 

* `contactPicker(picker: CNContactPickerViewController, didSelectContact contact: CNContact)` as a “single-selection picker”
* `contactPicker(picker: CNContactPickerViewController, didSelectContacts contacts: [CNContact])` as a “multi-selection picker”

Steps to Reproduce:

For all pickers, set `predicateForSelectionOfContact = NSPredicate(value: true)`

1) Present a single-selection picker, enter a search query, and select a search result that matches a non-name “contact property” (e.g. email address, phone number, company, etc.)

2) Present a multi-selection picker, enter a search query, and select a search result that matches by name only

3) Present a multi-selection picker, enter a search query, and select a search result that matches a non-name “contact property” (e.g. email address, phone number, company, etc.)

Expected Results:

1) The picker should be dismissed and the `didSelectContact` delegate method should be invoked

2) The search should be dismissed and the row that corresponds to the selected search result should be selected. Tapping the “Done” right bar button item should subsequently invoke the `didSelectContacts` delegate method.

3) The search should be dismissed and the row that corresponds to the selected search result should be selected. Tapping the “Done” right bar button item should subsequently invoke the `didSelectContacts` delegate method.

Actual Results:

1) A contact detail view controller is pushed onto the stack 

2) Nothing happens

3) A contact detail view controller is pushed onto the stack

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!