在IOS中获取错误的运营商名称 [英] Getting wrong carrier name in IOS

查看:123
本文介绍了在IOS中获取错误的运营商名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发IOS应用程序。我的要求是获取移动运营商名称。我使用了以下代码。

I am working on an IOS application.My requirement is to get the mobile carrier name.I used the following code.

In .h

#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <CoreTelephony/CTCarrier.h>

在.m

CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [netinfo subscriberCellularProvider];
NSLog(@"Carrier Name: %@", [carrier carrierName]);


Here in Log its printing "Carrier"

I谷歌搜索并找到此链接。但根据其回答我的设备仍未处于飞行模式且SIM卡存在于其中。如果有任何人工作,请帮助我。它消磨了我的时间。提前谢谢

I googled and found this link.But as per its answer my device is still not in airplane mode and sim card exists inside.If any one worked on it,please help me.Its killing my time.Thanks in advance

推荐答案

尝试使用移动国家/地区代码&这样的移动网络代码:

Try with mobile country code & mobile network code like this:

NSLog(@"Mobile Country Code: %@", [carrier mobileCountryCode]);
NSLog(@"Mobile Network Code: %@", [carrier mobileNetworkCode]);

然后您可以使用此列表来匹配您的结果。

Then you can use this list to match your results.

http://en.wikipedia.org/wiki/Mobile_country_code

祝你好运。

这篇关于在IOS中获取错误的运营商名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆