Eyal
Eyal

Reputation: 10828

iOS formatting phone numbers from address book

My app uses the user's phone number as unique username, and it also sync all of his contacts so he can send them messages.

So, I need a way to format all the phone numbers I'm getting from the phone's address book.

I need to know for a given number:

  1. Country code (if exists).

  2. The number itself.

And if the number includes some international call prefix, it should be remove from the number.

So for example if I have a contact with the number

014 1 3728834122  

The format should tell me that the country code is 1 and that the number is 3728834122 (I don't care about the 014 prefix)

What interesting is that the native phone address book seems to know how to format the number, I can see it while typing a new number, it added () or spaces when needed.

So my question is: Can I query the native address book for a given number, what's his country code & number?

Upvotes: 2

Views: 557

Answers (0)

Related Questions