I know how to pick a contact in iOS (using the CNContactPickerViewController), but how can I pick a specific phone number for a contact, instead of the contact itself, as a whole? That should be possible, according to the docs, but I didn't find out how.
EDIT: here's my code
CNContactPickerViewController *contactPicker = [[CNContactPickerViewController alloc] init];
contactPicker.delegate = self;
contactPicker.displayedPropertyKeys = @[CNContactGivenNameKey, CNContactImageDataAvailableKey, CNContactFamilyNameKey, CNContactPhoneNumbersKey, CNContactThumbnailImageDataKey, CNContactIdentifierKey];
[self presentViewController:contactPicker animated:YES completion:nil];
So, I do set the displayedProperties, but the result is the same, even if I choose only CNContactPhoneNumbersKey, I'm not presented with all contact's numbers so that I can choose a speicific number.
What am I missing?
EDIT 2: the callback methods, as requested. I don't know of what significance they are, but nevertheless.
-(void) contactPicker:(CNContactPickerViewController *)picker didSelectContact:(CNContact *)contact{
//NSLog(@"Contact : %@",contact);
NSString* contactName = [NSString stringWithFormat:@"%@%@%@", contact.givenName, @" ", contact.familyName];
[currentButton setTitle:contactName forState:UIControlStateNormal];
[currentName setText:contactName];
...
}
-(void) contactPickerDidCancel:(CNContactPickerViewController *)picker {
//NSLog(@"Cancelled");
}