0

SelectionOfProperty is not working if user has multiple phone numbers.

I am using below code:

let picker = CNContactPickerViewController()
picker.displayedPropertyKeys = [CNContactPhoneNumbersKey]

picker.predicateForEnablingContact = NSPredicate(format: "phoneNumbers.@count > 0")

picker.predicateForSelectionOfContact = NSPredicate(value: false) 

picker.predicateForSelectionOfProperty = NSPredicate(format: "key == 'phoneNumbers'")
picker.delegate = self

It's working perfectly fine when we using emailAddresses, but not when we changed to phoneNumbers.

aaK
  • 103
  • 9

1 Answers1

0

if you have multiple phone numbers set the predicateForEnablingContact as

picker.predicateForEnablingContact = NSPredicate(format: "phoneNumbers.@count > 1")

set the predicate format as "phoneNumbers.@count > 1"

Jeyamahesan
  • 1,101
  • 7
  • 15