如何使用 Swift 获取 LAC 和/或 CellID



亲爱的StackOverflow朋友们,我发现了如何为iOS设备获取MNC(M obile Network C ode(和MCC(Mobile C ountry C ode(,但我真的需要获取有关CellID和LAC(LocationArea Code(的信息。这不是一个应该进入AppStore的应用程序,我们需要它进行内部测试。我知道,有可能得到这样的跨国公司/MCC:

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

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

请检查

此代码,我已经添加了它

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))")
  }

}

相关内容

  • 没有找到相关文章

最新更新