检测iPad是否以编程方式支持SIM卡 [英] Detect whether iPad supports sim card programmatically

查看:67
本文介绍了检测iPad是否以编程方式支持SIM卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我有一个应用程序可以显示自上次重启以来用户使用的3G数据/Wifi.我想做的是,如果该应用程序在不支持SIM卡的iPad上运行,我想隐藏显示给用户的某些统计信息.

Currently, I have an app that shows the 3G data / Wifi used by the user since the last reboot. What I want to do is, if the app is running on an iPad which doesn’t support SIM card, I want to hide certain statistics shown to the user.

是否可以通过某种方式检测当前的iOS设备是否支持sim卡?

Is it somehow possible to detect whether the current iOS device supports a sim card or not?

推荐答案

据我所知,您无法检测到是否已安装SIM卡.您只能使用可达性来确定WWAN连接是否可用,也可以使用 CTCarrier

As far as I know, you cannot detect if the SIM card is installed. You can only determine if a WWAN connection is available using Reachability or you can use CTCarrier

@import CoreTelephony;

-(BOOL)hasCellularCoverage
{
    CTTelephonyNetworkInfo *networkInfo = [CTTelephonyNetworkInfo new];
    CTCarrier *carrier = [networkInfo subscriberCellularProvider];


    if (!carrier.isoCountryCode) {
        NSLog(@"No sim present Or No cellular coverage or phone is on airplane mode.");
        return NO;
    }
    return YES;
}

这篇关于检测iPad是否以编程方式支持SIM卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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