0

I have an iPhone app. The user can select a contact. Upon selection another view is opened where the user has to select a phone number.

This works great. However when the phone number contains country code like this +49 ... the app crashes.

-(BOOL)personViewController:(ABPersonViewController *)personViewController shouldPerformDefaultActionForPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier{
    ABMutableMultiValueRef multi = ABRecordCopyValue(person, property);
    CFStringRef phone = ABMultiValueCopyValueAtIndex(multi, identifier);

    ///....some code

    [self dismissModalViewControllerAnimated:YES];

    [personViewController.navigationController dismissModalViewControllerAnimated:YES];
    return NO;
}

It stops at this line

CFStringRef phone = ABMultiValueCopyValueAtIndex(multi, identifier);

but there is no error output in the log. Any idea how to fix this?

JeremyP
  • 84,577
  • 15
  • 123
  • 161
DarkLeafyGreen
  • 69,338
  • 131
  • 383
  • 601
  • possible duplicate of [Address book Phone number (+45) prefix causing crash!](http://stackoverflow.com/questions/4712071/address-book-phone-number-45-prefix-causing-crash) – JeremyP Oct 17 '11 at 08:21

1 Answers1

1

I don't know where you insert that "+" but you should try to get it replaced by something it can work with.

[yourString stringByReplacingOccurrencesOfString:@"+" withString:@"00"];

If it doesn't help try to follow this link: Address book Phone number (+45) prefix causing crash!

Community
  • 1
  • 1
Totumus Maximus
  • 7,543
  • 6
  • 45
  • 69