How can I get the MCC and MNC on an iPhone

前端 未结 3 1012
南旧
南旧 2020-12-17 04:23

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

相关标签:
3条回答
  • 2020-12-17 04:50

    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

    0 讨论(0)
  • 2020-12-17 04:55

    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.

    0 讨论(0)
  • 2020-12-17 05:12

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

    0 讨论(0)
提交回复
热议问题