Search code examples
iphoneobjective-ciosareavoicemail

Telephone area code to city name on iOS


On Apple's built-in Voicemail app, when it finds a phone number it does not recognize in your address book, it displays an approximate location under the number, presumably based on the phone number. How did they do that?? I'd guess there's a large database of area codes and exchange numbers on the phone, each mapping to a city or region name. Does anyone know if this mapping is accessible to apps via a public API?

There's lots of boilerplate code out there for mapping ZIP code to city, but I don't see much that does the same with area code / exchange. Any ideas?


Solution

  • There are a number of web sites that will tell you the city or cities for a given area code. Verizon has one, and other sites like http://www.allareacodes.com/ and http://www.411.com/area_zip_codes do about the same thing. You can probably find the same information in the front of your local telephone directory, too.

    Since there are fewer than 1000 possible area codes, I'd look for an area code list that you can include in your program. That way, this aspect of your app will work whether a network connection is available or not.