Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting carrier's name with CoreTelephony returns just "Carrier"

I tried getting carrier name with this code (using CoreTelephony):

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

It returns "Carrier". If i go to iPhone settings my carrier's name is correct there. My iOS on the phone is v4.2.1.

What am i doing wrong?

like image 335
DixieFlatline Avatar asked May 19 '11 08:05

DixieFlatline


1 Answers

Do you really get string "Carrier" or is the string empty? Documentation says:

The value for this property is nil if any of the following apply:

The device is in Airplane mode. There is no SIM card in the device. The device is outside of cellular service range.

Bet it's empty also in simulator.

Anyway, you should be checking mobileNetworkCode, since names are rarely correct (at least in Europe, where operators come and go changing their names quite often).

like image 147
JOM Avatar answered Oct 10 '22 08:10

JOM