Phone area code for iOS city name

In Apple's built-in voice mail application, when it finds a phone number that it does not recognize in your address book, it displays the approximate location under the number, presumably based on the phone number. How did they do it? I would suggest that the phone has a large database of area codes and exchange numbers, each of which is mapped to the name of a city or region. Does anyone know if this mapping is available for applications through the public API?

There is a template code for mapping a zip code to a city, but I don’t see much that does the same with a regional code / exchange. Any ideas?

+5
source share
3 answers

plist, : areacodes.plist. , :

plist:

1. plist .

2. :

NSBundle *bundle = [NSBundle mainBundle];
NSString *plistPath = [bundle pathForResource:@"areacodes" ofType:@"plist"];
NSDictionary *areaCodeDict = [[NSDictionary alloc] initWithContentsOfFile:plistPath];

3. , . - , - :

NSString *areaCode = @"801";
NSString *location = [self.areaCodeConversion objectForKey:areaCode];
NSLog(@"%@",location); // prints utah

:

1. .

2. , plist:

#import "AreaCodes.h"
...
AreaCodes *areaCodes = [[AreaCodes alloc] init];
NSString *location = [areaCodes getLocationForCode:@"801"];
NSLog(@"%@",location);
// prints "Utah"
+2

They would probably buy a commercial product from a company such as Telcordia (trainfo.com). I work for GreatData.com and we support codes and prefixes (also called "NPA / NXX"), as well as the main state of the city (tariff center), time zone, management company, etc., but we do not have latitude / longitude. (Telcordia will be).

I do not believe that you can find the data you are looking for in a free product. We spent a lot of time manually checking our data.

+1
source

All Articles