No SIM card inserted

I use the call function in the application. The problem is that if the device does not have a SIM card, then "No SIM card inserted." The warning display is displayed 2 times. I am using this code:

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:phoneNumber]])
    {
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
    }

Note. The first type of warning is automatically hidden and the second appears.

+4
source share
2 answers

Finally, an alternative solution was found for this:

This is actually not a problem. This is the transition effect:

To solve this problem, I included the code below before calling the function:

@import CoreTelephony;


CTTelephonyNetworkInfo *networkInfo = [CTTelephonyNetworkInfo new];
    CTCarrier *carrier = [networkInfo subscriberCellularProvider];
    if (!carrier.isoCountryCode) {
        UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"No SIM Card Installed" message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
        [alert show];
    }
    else{

        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
    }
+2
source

First check your device. SIM card is available or not. I think your device is currently not turned on. SIM card.

-2
source

All Articles