8

Is there any way of getting the mnc and mcc numbers on an iPhone?

JOM
  • 8,139
  • 6
  • 78
  • 111
Johan
  • 1,951
  • 1
  • 18
  • 22

2 Answers2

6

You need the CoreTelephony framework

CTTelephonyNetworkInfo *networkInfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [networkInfo subscriberCellularProvider];

to get MNC,

NSString *mnc = [carrier mobileNetworkCode];

to get MCC,

NSString *mcc = [carrier mobileCountryCode];
Johan
  • 1,951
  • 1
  • 18
  • 22
honcheng
  • 2,014
  • 13
  • 14
  • Thanks. The question was asked in 3.2 time so this wasn't a solution for my first problem. But that was over a year ago so if I don't have to be compatible with old devices, this is the best solution. – Johan Mar 21 '11 at 06:44
  • 1
    In order to retrieve the CTCarrie your need the Network info first: `CTTelephonyNetworkInfo *networkInfo = [[CTTelephonyNetworkInfo alloc] init]; CTCarrier *carrier = [networkInfo subscriberCellularProvider];`. The code in the answer will return nil for both. – Felix Lamouroux Dec 05 '13 at 15:04
  • why is this marked as the correct answer? My country code for my phone number is +1, I am not getting that using this solution... – zumzum Aug 02 '14 at 13:49
  • @zumzum The "country code" you're looking for and the standardized MCC is not the same thing... – Scorchio Oct 03 '14 at 14:30
1

You can use the methods of the CTCarrier class to retrieve Country and network code. However this is only for the home provider (=SIM Card) and not the provider the phone is currently booked in,

holtmann
  • 6,043
  • 32
  • 44