Search code examples
iosobjective-ciphoneswift

How can I get details about the device data provider (like Verizon/AT&T) of an iphone programmatically?


I am trying to create an ios application and I want to segment the users based on the data providers they are using, such as Verizon and AT&T. Is it possible to get this information programmatically from the ios application.


Solution

  • 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