iOS I can't get my carrier name

坚强是说给别人听的谎言 提交于 2019-12-03 03:39:12

Did you explicitly import CTCarrier?

#import <CoreTelephony/CTCarrier.h>

I have same problem too,and try to log by device:

NSLog(@"carrierName = %@",carrier.carrierName);
NSLog(@"mobileCountryCode = %@",carrier.mobileCountryCode);
NSLog(@"mobileNetworkCode = %@",carrier.mobileNetworkCode);
NSLog(@"isoCountryCode = %@",carrier.isoCountryCode);
NSLog(@"allowVOIP = %d",carrier.allowsVOIP);

result:

2012-05-29 11:48:31.466 carrierTest[357:707] mobileCountryCode = 466

2012-05-29 11:48:31.469 carrierTest[357:707] mobileNetworkCode = 97

2012-05-29 11:48:31.470 carrierTest[357:707] isoCountryCode = tw

2012-05-29 11:48:31.472 carrierTest[357:707] allowVOIP = 1

the object carrierName is "....." in run stack,actually it should be "台湾大哥大"

it seem like string encoding problem cause i can't get it? I have no idea...

you can try the other carrier SIM card.

Try

NSLog(@"Carrier Name: %@", carrier.carrierName);

instead.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!