I am implementing the ContactsUI Framework and am having issues with PredicateForSelectionOfContact. I'm trying to have it so that details are shown when a contact is selected that has more than 1 email address. Here's the code I'm using:
var picker = new CNContactPickerViewController();
picker.DisplayedPropertyKeys = new NSString[] {CNContactKey.EmailAddresses};
picker.PredicateForEnablingContact = NSPredicate.FromFormat("emailAddresses.@count > 0");
picker.PredicateForSelectionOfContact = NSPredicate.FromFormat("emailAddresses.@count == 1");
picker.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
picker.ModalTransitionStyle = UIModalTransitionStyle.CoverVertical;
picker.Delegate = new ContactPickerDelegate(ViewModel);
PresentViewController(picker, true, () => {});
However when I select a contact with 2 email addresses, ContactPickerDelegate.DidSelectContact() is being called instead of showing the detail. It does show details for contacts with 3 email addresses. I'm not able to add a 4th email address to a contact for further testing. Why is emailAddresses.@count == 1 not being respected?
