Reputation: 2618
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
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