PredicateForSelectionOfContact not being respected

CaseyHancockCaseyHancock USMember ✭✭

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("[email protected] > 0");
    picker.PredicateForSelectionOfContact = NSPredicate.FromFormat("[email protected] == 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, and I'm not able to add a 4th email address to a contact for further testing. Why is "emailAddresses.@count == 1" not being respected?

Sign In or Register to comment.