开发者

How can I get the MCC and MNC on an iPhone

As per the subject - is there an AP开发者_如何学运维I to get the MCC/MNC on iPhone OS 2.1 or above?


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


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜