• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

iphone - 获取 iPhone 运营商接收状态? (不是互联网)

[复制链接]
菜鸟教程小白 发表于 2022-12-13 10:45:38 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

我需要知道用户理论上是否可以调用电话。

当用户的 iPhone 能够连接到运营商的网络时,有谁知道如何“返回 true”(使用 Cocoa iOS)? (不是互联网)

或者如何以编程方式告诉用户“有多少个接收栏”?



Best Answer-推荐答案


将您的应用程序与 CoreTelephony.framework

相关联

您可以检查 CTCarrier 对象,看看对于某些需要与 Phone Provider 连接的属性是否有有效结果 (!=nil)。

例如,下面有一段代码用于检查 CTCarriermobileNetworkCode 属性。此属性为 != nil 如果且仅当设备连接到电话提供商(您所需的任务,用户能够调用电话,包含在上述状态中)。

CTTelephonyNetworkInfo *netInfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [netInfo subscriberCellularProvider];

//The value for this property is nil if any of the following apply:
//  - The device is in Airplane mode.
//  - There is no SIM card in the device.
//  - The device is outside of cellular service range.
NSString *mnc = [carrier mobileNetworkCode]; 

if(!mnc) {
    //if we're here, than probably we're disconnected from the Phone Provider
}

netInfo.subscriberCellularProviderDidUpdateNotifier = ^ (CTCarrier * carrier) {
    //this block is executed each time we've a change to the state of the carrier
    //be sure to check the carrier object, in order to see is we're connected to a
    //phone provider.

};

Apple 开发者文档网址中的更多信息:http://developer.apple.com/library/IOs/#documentation/NetworkingInternet/Reference/CTCarrier/Reference/Reference.html

关于iphone - 获取 iPhone 运营商接收状态? (不是互联网),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8892860/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap