iPhone - how to determine carrier of the device (AT&T, Verizon, etc?)

后端 未结 3 409
伪装坚强ぢ
伪装坚强ぢ 2021-02-01 20:14

Is there a way to get information about the carrier of iPhones programmatically?

3条回答
  •  执笔经年
    2021-02-01 20:47

    While developing in Swift 3.0, You just need to import CoreTelephony in you link binary with libraries in Build phases.

    // Setup the Network Info and create a CTCarrier object

     let networkInfo = CTTelephonyNetworkInfo()
     let carrier = networkInfo.subscriberCellularProvider
    

    // Get carrier name

     print(carrier?.carrierName)
    

    That's it.

提交回复
热议问题