Sagar D
Sagar D

Reputation: 2618

Detect whether iPad supports sim card programmatically

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.

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

Upvotes: 0

Views: 552

Answers (1)

Saeed-rz
Saeed-rz

Reputation: 1443

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;
}

Upvotes: 1

Related Questions