Saleel
Saleel

Reputation: 11

MobileCOuntryCode iOS not working

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

Upvotes: 1

Views: 1231

Answers (1)

vinoth kannan
vinoth kannan

Reputation: 173

#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.

Upvotes: 5

Related Questions