iosnetwork-programmingcore-telephonycarrier

Retrieving Carrier Name from iPhone programmatically


Is there a way to know the cell carrier on an iPhone programmatically?

I am looking for the carrier name which the iPhone is connected to.


Solution

  • In iOS 4, the CoreTelephony framework is useable, here's a snippet to get the carrier name:

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

    Link against CoreTelephony and include in your headers:

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