Stackoverflow 上的其他人发布了一种从联系人列表中获取用户选择的电话号码的方法。可以为电子邮件地址完成,如果可以,我该怎么做?这是代码:
- (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;
}
这是帖子的链接: 如何从通讯录中获取个人电话号码?