1

For lower than ios9, I used to write

picker.displayedProperties = @[@(kABPersonEmailProperty)];

For ios9, what will be the displayedPropertyKeys ( picker.displayedPropertyKeys = @[@(????)]; )

Note:- picker is ABPeoplePickerNavigationController for ios8 and CNContactPickerViewController for ios9.

I am basically fetching the contacts using Contacts framework.

pkc456
  • 8,350
  • 38
  • 53
  • 109
  • 1
    https://developer.apple.com/library/prerelease/ios/documentation/Contacts/Reference/CNContact_Class/index.html#//apple_ref/doc/constant_group/Metadata_Keys ? – Larme Nov 25 '15 at 12:51
  • Thanks for detailed answer. Day saviour – pkc456 Nov 26 '15 at 04:57

1 Answers1

1

Use the following:

Objective-C

picker.displayedPropertyKeys = @[CNContactEmailAddressesKey];

Swift 5.2

picker.displayedPropertyKeys = [CNContactPhoneNumbersKey]

A full list of available keys can be found at https://developer.apple.com/documentation/contacts/contact_keys.

Adriano
  • 482
  • 5
  • 18
Developer
  • 78
  • 8
  • This is what I am looking for. I also came across https://developer.apple.com/library/prerelease/ios/documentation/Contacts/Reference/CNContact_Class/index.html#//apple_ref/doc/constant_group/Metadata_Keys for all metadata keys. – pkc456 Nov 26 '15 at 04:57
  • 3
    Please, fix your post. It's not an array of NSNumber, but an array of NSString: picker.displayedPropertyKeys = @[CNContactEmailAddressesKey]; – Lapinou Aug 03 '16 at 13:53