当我使用 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, nil];
[alert show];
}
[self dismissViewControllerAnimated:YES completion:nil];
return NO;
}
我得到的变量号是 .925.3248930,在控制台中它添加了某种“。” 在空格的位置。我尝试修剪空格,但我这样做非常不成功。伙计们,你能帮我解决这个问题吗?难道我做错了什么?