Monday, December 26, 2022
HomeiOS Developmentswift - iOS 16 Contact Picker invalid predicate

swift – iOS 16 Contact Picker invalid predicate


I wish to current ContactPicker in iOS and allow contacts having at the least one cellphone quantity.

let contactPicker = CNContactPickerViewController()
contactPicker.delegate = self
contactPicker.displayedPropertyKeys = [
    CNContactGivenNameKey,
    CNContactFamilyNameKey,
    CNContactPhoneNumbersKey
]        
contactPicker.predicateForEnablingContact = NSPredicate(format: "phoneNumbers.@rely > 0")
current(contactPicker, animated: true, completion: nil)

Evidently NSPredicate doesn’t have any downside, but it surely does’t work.

2022-12-26 18:54:07.355927+0330 challenge[23170:4324947] [CNUI ERROR] Error when displaying picker: Error Area=CNErrorDomain Code=300 "(null)" UserInfo={CNValidationErrors=(
    "Error Area=CNErrorDomain Code=400 "Invalid Predicate" UserInfo={NSLocalizedDescription=Invalid Predicate, NSLocalizedFailureReason=The operation couldnU2019t be accomplished as a result of its predicate is invalid.}"
)}



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments