在IOS中获取错误的运营商名称
我正在开发一个IOS应用程序。我的要求是获取移动运营商的名称。我使用了以下代码 In.h在IOS中获取错误的运营商名称,ios,iphone,objective-c,core-telephony,Ios,Iphone,Objective C,Core Telephony,我正在开发一个IOS应用程序。我的要求是获取移动运营商的名称。我使用了以下代码 In.h 我在谷歌上搜索了一下,找到了。但根据它的回答,我的设备仍然没有处于飞行模式,里面有sim卡。如果有人使用过,请帮助我。这会浪费我的时间。提前谢谢你。请尝试使用手机国家代码和手机网络代码,如下所示: NSLog(@"Mobile Country Code: %@", [carrier mobileCountryCode]); NSLog(@"Mobile Network Code: %@", [carrier
我在谷歌上搜索了一下,找到了。但根据它的回答,我的设备仍然没有处于飞行模式,里面有sim卡。如果有人使用过,请帮助我。这会浪费我的时间。提前谢谢你。请尝试使用手机国家代码和手机网络代码,如下所示:
NSLog(@"Mobile Country Code: %@", [carrier mobileCountryCode]);
NSLog(@"Mobile Network Code: %@", [carrier mobileNetworkCode]);
然后您可以使用此列表匹配您的结果
祝你好运
CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [netinfo subscriberCellularProvider];
NSLog(@"Carrier Name: %@", [carrier carrierName]);
Here in Log its printing "Carrier"
NSLog(@"Mobile Country Code: %@", [carrier mobileCountryCode]);
NSLog(@"Mobile Network Code: %@", [carrier mobileNetworkCode]);