views:

983

answers:

4

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

** update **

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

+1  A: 

Isnt it a constant?

CARRIER_NAME = "AT&T"

Shane C. Mason
don't forget, the iPhone is global, not just USA.
crashmstr
Oh come on people - have a sense of humor! It's tuesday for the love of God!
Shane C. Mason
+1 hardcoding FTW
George
If you make a joke, and have to remind people twice to have a sense of humor, it probably wasn't funny.
SP
+3  A: 

There is no public API for getting the carrier name. If you don't need to publish on the App Store you could look at using private api's.

VVCarrierParameters.h in the VisualVoiceMail package seems to have a carrierServiceName class method that might be what you need. Drop that header in your project and call [VVCarrierParameters carrierServiceName].

Note your app will most likely be rejected if you do this.

Jason Harwig
How to fix the `Symbols(s) not found` error when linking? Thanks
ohho
A: 

https://developer.apple.com/iphone/prerelease/library/documentation/NetworkingInternet/Reference/CTCarrier/Reference/Reference.html#//apple_ref/doc/uid/TP40009596-CH1-DontLinkElementID_3

There is a such way however it's only available on iOS 4 so you won't be able to use it on previous versions. And this probably breaks your backward compatibility too.

radalin
+2  A: 

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];
George Zhu