导入CoreTelephony 库文件
引入头文件
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <CoreTelephony/CTCarrier.h>
//判断是否有SIM卡
-(BOOL)isSIMInstalled
{
CTTelephonyNetworkInfo *networkInfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [networkInfo subscriberCellularProvider];
if (!carrier.isoCountryCode) {
DbgLog(@"No sim present Or No cellular coverage or phone is on airplane mode.");
return NO;
}
return YES;
}