1

亲爱的StackOverflow朋友们,我知道了如何获取 iOS 设备的 MNC(移动网络代码)和 MCC(移动国家代码,但我确实需要获取有关CellIDLAC L位置A rea代码)。它不是一个应该进入 AppStore 的应用程序,我们需要它来进行内部测试。我知道,有可能像这样获得 MNC/MCC:

var mob = CTTelephonyNetworkInfo()  

    if let r = mob.subscriberCellularProvider {  
        print("CountryCode: \(r.mobileCountryCode!)")  
        print("NetworkCode: \(r.mobileNetworkCode!)")  

    }  

但是有没有可能在 iOS 11 中使用 swift 获取 LAC/CellID?

4

1 回答 1

1

请检查此代码,我已添加

import UIKit
 import CoreTelephony

class mobile: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

      let telephonyInfo: CTTelephonyNetworkInfo = CTTelephonyNetworkInfo()
      let carrierNetwork: String = telephonyInfo.currentRadioAccessTechnology!
      print("mobile network : \(carrierNetwork)")

      let carrier = telephonyInfo.subscriberCellularProvider

      let countryCode = carrier?.mobileCountryCode
      print("country code:\(String(describing: countryCode))")

      let mobileNetworkName = carrier?.mobileNetworkCode
      print("mobile network name:\(String(describing: mobileNetworkName))")

      let carrierName = carrier?.carrierName
      print("carrierName is : \(String(describing: carrierName))")

      let isoCountrycode = carrier?.isoCountryCode
      print("iso country code: \(String(describing: isoCountrycode))")

  }



}
于 2018-05-11T09:59:41.443 回答