iOS我无法获得我的运营商名称 [英] iOS I can't get my carrier name

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

问题描述

如此处所述 - > 以编程方式从iPhone检索运营商名称

as explained here -> Retrieving Carrier Name from iPhone Programmatically

我正在尝试获取我的运营商名称,我正在使用此代码

i'm trying to get my carrier's name, i'm using this code

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

但我收到 [carrier carrierName] :未找到实例方法'-carrierName'

but i receive a warning on [carrier carrierName]: Instance method '-carrierName' not found

我已经添加了框架coretelephony到我的项目但是当我执行我的应用程序时它崩溃了!

i've added and the framework coretelephony to my project but when i execute my app it crashes!

感谢所有人!

推荐答案

您是否明确导入了CTCarrier?

Did you explicitly import CTCarrier?

#import <CoreTelephony/CTCarrier.h>

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

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