Someone else here at Stackoverflow has posted a way to get a user-selected phone number from a contact list. Can be done for email addresses, and if so, how can I do this? Here is the code:
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier
{
if (property == kABPersonPhoneProperty) {
ABMultiValueRef multiPhones = ABRecordCopyValue(person, kABPersonPhoneProperty);
for(CFIndex i = 0; i < ABMultiValueGetCount(multiPhones); i++) {
if(identifier == ABMultiValueGetIdentifierAtIndex (multiPhones, i)) {
CFStringRef phoneNumberRef = ABMultiValueCopyValueAtIndex(multiPhones, i);
CFRelease(multiPhones);
NSString *phoneNumber = (__bridge NSString *) phoneNumberRef;
CFRelease(phoneNumberRef);
_contactNumber.text = [NSString stringWithFormat:@"%@", phoneNumber];
}
}
}
[self dismissViewControllerAnimated:YES completion:nil];
return NO;
}
Here is the link to the message:
How do you get a person’s phone number from the address book?
source
share