Created
December 5, 2014 13:14
-
-
Save digitaljerry/3fa5c8ad8d5bf4bc9094 to your computer and use it in GitHub Desktop.
Country Code From Carrier
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (NSString *)getCountryCodeFromCarrier | |
{ | |
if (NSClassFromString(@"CTTelephonyNetworkInfo") != nil) | |
{ | |
CTTelephonyNetworkInfo *network_Info = [CTTelephonyNetworkInfo new]; | |
CTCarrier *carrier = network_Info.subscriberCellularProvider; | |
NSLog(@"country code is: %@", carrier.mobileCountryCode); | |
return carrier.isoCountryCode; | |
} | |
else{ | |
return nil; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment