1

Apple provided a sample project called PeoplePicker that launches an ABPeoplePickerNavigationController of only contacts that have email addresses:

ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;

// The people picker will only display the person's name, image and email properties in ABPersonViewController.
picker.displayedProperties = @[@(kABPersonEmailProperty)];

// The people picker will enable selection of persons that have at least one email address.
picker.predicateForEnablingPerson = [NSPredicate predicateWithFormat:@"emailAddresses.@count > 0"];

How do I display only the contacts that have mobile/telephone numbers? I already dug around the Apple docs to find what key to use for the @count operation (emailAddresses in this example), but I can't find it.

Matthew Quiros
  • 13,385
  • 12
  • 87
  • 132

1 Answers1

2

Use ABPersonPhoneNumbersProperty like so:

[NSPredicate predicateWithFormat:@"%K.@count > 0", ABPersonPhoneNumbersProperty];
Daniel
  • 8,794
  • 4
  • 48
  • 71