iosphone-number

Best Practice storing phone numbers: with or without formatting?


My app pulls phone numbers from the IOS address book and then stores them in core data. I've noticed that the IOS address book stores the data with formatting i.e. (650) 555 5555. This causes problems as when you try to send this to an url to call or text it doesn't work.

For other phone numbers entered manually in my app, I have been storing them without formatting and formatting them only on display.

Is there a preferred approach to storing character-free vs. with characters?


Solution

  • It's really up to you and the use you're going to give the numbers.

    I've done this in the past and we chose to store phone numbers in with just plain numbers and display them with formatting according to the location since most likely all the contact numbers would be from a specific country or location. That was going to be easier for a person to look at.

    Also we could just use the number stored without any modification to just call or send texts because that required the phone without formatting.