当我使用ABpeoplePickerNavigationController时,当调用下面的委托时,我试图执行以下操作:
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier
{
if(property == kABPersonPhoneProperty || property == kABPersonEmailProperty)
{
NSString *name = (__bridge NSString *)ABRecordCopyCompositeName(person);
ABMutableMultiValueRef multi = (ABMultiValueRef)ABRecordCopyValue(person, property);
NSString *number = (__bridge NSString*)ABMultiValueCopyValueAtIndex(multi, identifier);
if(![VZMUtils validateEmail:number])
number = [VZMUtils formatIdentificationNumber:number];
number = [number stringByReplacingOccurrencesOfString:@"." withString:@""];
ALog(@"number %@ and name %@",number,name);
[self.popoverDelegate setDataWithName:name andDetail:number];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Invalid type selected." message:@"Please select either a phone number or email address to add as a recipient" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, …Run Code Online (Sandbox Code Playgroud)