When i am using ABpeoplePickerNavigationController, when the below delegate gets called, I am trying to do the following:
- (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;
}
The variable number what i am getting is .925.3248930, in the console it is adding some kind of a "." in positions of a whitespace. I tried trimming whitespaces still i am very unsuccesful in doing so. Guys can you help me out in this? Am i doing something wrong?