iPhone - Detecting SIM card availability

The CTCarrier object has 5 properties:

allowsVOIP
carrierName
isoCountryCode
mobileCountryCode
mobileNetworkCode

I have made some tests regarding CTCarrier and I have come to the conclusion that for iOS 7 only carrierName and allowsVOIP are retained when SIM is removed. isoCountryCode, mobileCountryCode and mobileNetworkCode are reset for iOS 7. That's how you can detect if a SIM is present or not.

For iOS 6 all the values are retained.

I performed the tests using an iPhone 4S and iPhone 5 both running iOS 7.


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

According to the documentation for [CTCarrier carrierName]:

If you configure a device for a carrier and then remove the SIM card, this property retains the name of the carrier.

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.