MobileCOuntryCode iOS not working

1.2k views Asked by At

From the below post i am trying to detect the SIM in iPhone

Detect if Sim Card is available in iPhone programmatically

I tried the same code provided by you but it always return me (null). I have added core telephony framework and imported CTCarrier.h file. Is there anything more i need to do?

Thanks

1

There are 1 answers

3
vinoth kannan On
#import <CoreTelephony/CTCarrier.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>

CTTelephonyNetworkInfo* info = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier* _carrier = info.subscriberCellularProvider;
NSLog(@"carrierName %@",_carrier.carrierName);
NSLog(@"isoCountryCode %@",_carrier.isoCountryCode);
NSLog(@"mobileCountryCode %@",_carrier.mobileCountryCode);
NSLog(@"mobileNetworkCode %@",_carrier.mobileNetworkCode);

Try this method its work.