-1

My code is:

if(![MFMessageComposeViewController canSendText]) {
    UIAlertView *warningAlert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Your device doesn't support SMS!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [warningAlert show];
    return;
}

It works correctly with simulator but not working in iPhone without a SIM card.

mauris
  • 42,982
  • 15
  • 99
  • 131
ragu
  • 133
  • 2
  • 10

1 Answers1

1

Use this code might be help you.

 CTTelephonyNetworkInfo* info = [[CTTelephonyNetworkInfo alloc] init];
    CTCarrier* carrier = info.subscriberCellularProvider;

    if(carrier.mobileNetworkCode == nil || [carrier.mobileNetworkCode isEqualToString:@""])
    {
        NSLog("Not available")
    }else{
        NSLog("available")     
    }
Hitesh Surani
  • 12,733
  • 6
  • 54
  • 65