Вопрос

I am working on an IOS application.My requirement is to get the mobile carrier name.I used the following code.

In .h

#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <CoreTelephony/CTCarrier.h>

In .m

CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [netinfo subscriberCellularProvider];
NSLog(@"Carrier Name: %@", [carrier carrierName]);


Here in Log its printing "Carrier"

I googled and found this link.But as per its answer my device is still not in airplane mode and sim card exists inside.If any one worked on it,please help me.Its killing my time.Thanks in advance

Это было полезно?

Решение

Try with mobile country code & mobile network code like this:

NSLog(@"Mobile Country Code: %@", [carrier mobileCountryCode]);
NSLog(@"Mobile Network Code: %@", [carrier mobileNetworkCode]);

Then you can use this list to match your results.

http://en.wikipedia.org/wiki/Mobile_country_code

Good luck.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top