5

As per the subject - is there an API to get the MCC/MNC on iPhone OS 2.1 or above?

Airsource Ltd
  • 32,379
  • 13
  • 71
  • 75

3 Answers3

31

Added in iOS4

CTTelephonyNetworkInfo *netInfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [netInfo subscriberCellularProvider];
NSString *mcc = [carrier mobileCountryCode];
NSString *mnc = [carrier mobileNetworkCode];

http://developer.apple.com/library/ios/#Documentation/NetworkingInternet/Reference/CTCarrier/Reference/Reference.html

Rok Jarc
  • 18,765
  • 9
  • 69
  • 124
koregan
  • 10,054
  • 4
  • 23
  • 36
1

No, mobile network information is not available through the API. If you're looking for a unique device ID, take a look at UIDevice's uniqueIdentifer method; if you're looking for the country the device is in, you need Location Services; if you want a good indication of the user's home region, take a look at NSLocale; for anything else, just ask the user.

Becca Royal-Gordon
  • 17,541
  • 7
  • 56
  • 91
  • Thanks for the response - sadly Location Services requires asking the user, in the sense that they get a popup asking if it's ok. – Airsource Ltd Mar 25 '09 at 16:17
0

I think you could just get the phone number of the iPhone and parse it out for the country code.

Community
  • 1
  • 1
Phill Pafford
  • 83,471
  • 91
  • 263
  • 383