With CNContactPickerViewController in iOS 9.0, how to enable/disable single or multiple selection?

PatrickV picture PatrickV · Sep 28, 2015 · Viewed 7.1k times · Source

The delegate CNContactPickerDelegate have methods for single and multiple selections. But how do we specify we want single or multiple selection when we present the view controller?

I guess I miss something that perhaps also causes the problem I have described in: CNUI ERROR Selection predicates are set but the delegate does not implement contactPicker:didSelectContact:

Answer

Joel picture Joel · Sep 29, 2015

You need to implement ONLY the method you need.

If you want only one contact, implement:

contactPicker:didSelectContact:

If you want multiple selection, implement:

contactPicker:didSelectContacts:

If you want select one property for one contact, implemente:

contactPicker:didSelectContactProperty:

And the last one, don't know how work, looks like a bug, because if I implement it, I get the multiple contact selection UI, but can't select properties.

contactPicker:didSelectContactProperties:

EDIT: Finally I got some data from didSelectContactProperties, this method required a definition in predicateForSelectionOfProperty. I think the name is incorrect, should be didSelectContactsProperties, because I got the properties for multiple contacts.