Retrieving Carrier Name from iPhone programmatically
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
#import
How can I get details about the device data provider (like Verizon/AT&T) of an iphone programmatically?
You should check the CTCarrier
.
Just import CoreTelephony
into your Swift file.
Then you can use the carrierName
property to get the name of your carrier.
// Setup the Network Info and create a CTCarrier object
let networkInfo = CTTelephonyNetworkInfo()
let carrier = networkInfo.subscriberCellularProvider
// Get carrier name
let carrierName = carrier.carrierName
iOS I can't get my carrier name
Did you explicitly import CTCarrier?
#import
iPhone - how to determine carrier of the device (AT&T, Verizon, etc?)
1st Import #import
as well as #import
(make sure you have the CoreTelephone.framework installed too).
CTTelephonyNetworkInfo *phoneInfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *phoneCarrier = [phoneInfo subscriberCellularProvider];
NSLog(@"Carrier = %@", [phoneCarrier carrierName]);
[phoneInfo release];
Related Topics
Custom Edit View in Uitableviewcell While Swipe Left. Objective-C or Swift
Error: Error Installing Cocoapods: Error: Failed to Build Gem Native Extension
iOS Uitextview or Uilabel with Clickable Links to Actions
Set the Maximum Character Length of a Uitextfield in Swift
Uipageviewcontroller Gesture Recognizers
Unexpectedly Found Nil Iboutlet in Prepareforsegue
Best Way to Add License Section to iOS Settings Bundle
Unexpected Cfbundleexecutable Key
How to Increase the Height of Navigation Bar in Xcode
iOS Application Executing Tasks in Background
Displaying Splash Screen for Longer Than Default Seconds
Ios App With Arc, Find Who Is Owner of an Object
Uiview and Initwithframe and a Nib File. How to Get the Nib File Loaded
Warning :-Presenting View Controllers on Detached View Controllers Is Discouraged