iOS I can't get my carrier name

Gianluca picture Gianluca · Nov 15, 2011 · Viewed 7.7k times · Source

as explained here -> Retrieving Carrier Name from iPhone Programmatically

i'm trying to get my carrier's name, i'm using this code

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

but i receive a warning on [carrier carrierName]: Instance method '-carrierName' not found

i've added and the framework coretelephony to my project but when i execute my app it crashes!

thanks to all!

Answer

Eric picture Eric · Nov 15, 2011

Did you explicitly import CTCarrier?

#import <CoreTelephony/CTCarrier.h>