Reputation: 794
Dear friends of StackOverflow, I found out how to get the MNC (Mobile Network Code) and MCC (Mobile Country Code) for an iOS device but I really need to get information about the CellID and the LAC (Location Area Code). It's not an app which is so supposed to get into the AppStore, we need this for internal testing. I know, its possible to get MNC/MCC like that:
var mob = CTTelephonyNetworkInfo()
if let r = mob.subscriberCellularProvider {
print("CountryCode: \(r.mobileCountryCode!)")
print("NetworkCode: \(r.mobileNetworkCode!)")
}
But are there any possibilities for getting LAC/CellID using swift in iOS 11?
Upvotes: 1
Views: 2271
Reputation: 23
Please check this code and I have added it
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))")
}
}
Upvotes: 1