Address book Phone number (+45) prefix causing crash!
Posted
by
CCDEV
on Stack Overflow
See other posts from Stack Overflow
or by CCDEV
Published on 2011-01-17T10:22:46Z
Indexed on
2011/01/17
13:53 UTC
Read the original article
Hit count: 202
Hi Guys...
I am having trouble getting phone numbers from the iPhone Addressbook.
There is no problem when the number do not contain a country code prefix like +45, but if it does, my app crashes...
Is this a known issue? I haven't been able to find anything about it...
Thanks
EDIT:
I get phonenumber like this:
-(void)getContact
{
ABPeoplePickerNavigationController *pp = [[ABPeoplePickerNavigationController alloc] init];
pp.displayedProperties = [NSArray arrayWithObject:[NSNumber numberWithInt:kABPersonPhoneProperty]];
pp.peoplePickerDelegate = self;
[self presentModalViewController:pp animated:YES];
[pp release];
}
- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker {
// assigning control back to the main controller
[self dismissModalViewControllerAnimated:YES];
}
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person {
return YES;
}
-(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier {
ABMultiValueRef phoneProperty = ABRecordCopyValue(person,property);
saveString = (NSString *)ABMultiValueCopyValueAtIndex(phoneProperty,identifier);
saveString = [saveString stringByReplacingOccurrencesOfString:@" " withString:@""];
nummerTextField.text = saveString;
}
© Stack Overflow or respective owner