views:

247

answers:

2

Hi All,

I just want to search my IPhone's address book by a received call's phone number. How can I proceed further in this case? Suppose my received call is in the format of (ISD code) xxxxxxxxxx, like (+1 1234567890) or (001 1234567890) or (+11234567890) or (+1 (123) 456-7890) or (1234567890 without ISD code) or something else. So how can I search the entire address book data base to get the contacts info by using only (ISD CODE)1234567890? Can somebody help me please?

Regards, Prathap.

A: 

By searching over internet and looking into API, I came across to these, "TILL NOW THERE IS NO WAY TO DO THIS". The address book stores the phone numbers (if you're adding a phone number through "contacts" the ph num will be stored in a different format else if the phone number is copied from SIM then it saved in a different format) in a formatted way based upon the localization settings. So to get the contact with the phone number, the phone number should be formatted based upon localization settings and searched entire address book.

prathumca
A: 

You can remove all the spaces and brackets and compare only the digits, with a longest suffix matching.

And searching through the ENTIRE address book is the only way, as the SDK did not provide a ABAddressBookCopyPeopleWithNumber. I wished they would provide one.

samwize