【问题标题】:How to get LAC and/or CellID using Swift如何使用 Swift 获取 LAC 和/或 CellID
【发布时间】:2018-08-20 04:43:58
【问题描述】:

StackOverflow 的朋友们, 我发现了如何获得 MNC (Mobile Network Code) 和 MCC (Mobile Country Code)适用于 iOS 设备,但我确实需要获取有关 CellID 和 LAC(L位置Area Code)。它不是一个应该进入 AppStore 的应用程序,我们需要它来进行内部测试。 我知道,这样获得 MNC/MCC 是可能的:

var mob = CTTelephonyNetworkInfo()  

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

    }  

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

【问题讨论】:

  • 跨国公司 /MCC / LAC ????
  • 我的意思是位置区域代码、移动网络代码和移动国家代码。
  • 您是否设法在 swift 中找到了这个?
  • 不,我没有,确实很伤心

标签: ios mobile cellid


【解决方案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))")

  }



}

【讨论】:

    猜你喜欢
    • 2015-06-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-30
    • 1970-01-01
    相关资源
    最近更新 更多