Post

Replies

Boosts

Views

Activity

Reply to The public API CTTelephonyNetworkInfo of Apple is returning wrong MNC in romaing
We are using this to get the MCC & MNC let networkInfo = CTTelephonyNetworkInfo()    var carrier: [String:CTCarrier]? = nil         if #available(iOS 13.0, *) {      guard let str = networkInfo.dataServiceIdentifier else {        UIApplication.shared.endBackgroundTask(bgTask)        return ("","") }      carrier = networkInfo.serviceSubscriberCellularProviders      let ctCarrier = carrier?[str]      guard let _ = ctCarrier?.mobileCountryCode, let _ = ctCarrier?.mobileNetworkCode else {        UIApplication.shared.endBackgroundTask(bgTask)        return ("","")}      UIApplication.shared.endBackgroundTask(bgTask)      //NewChanges      return ((ctCarrier?.mobileCountryCode ?? ""), (ctCarrier?.mobileNetworkCode ?? ""))} This code give wrong MNC in Roaming
Jun ’21
Reply to The public API CTTelephonyNetworkInfo of Apple is returning wrong MNC in romaing
Below function we are using static func getMccMnc() -> (mcc: String, mnc: String) {     let bgTask = UIApplication.shared.beginBackgroundTask {       print("BackgroundTask Expired")     }           let networkInfo = CTTelephonyNetworkInfo()     var carrier: [String:CTCarrier]? = nil           if #available(iOS 13.0, *) {       guard let str = networkInfo.dataServiceIdentifier else {         UIApplication.shared.endBackgroundTask(bgTask)         return ("","") }       carrier = networkInfo.serviceSubscriberCellularProviders       let ctCarrier = carrier?[str]       guard let _ = ctCarrier?.mobileCountryCode, let _ = ctCarrier?.mobileNetworkCode else {         UIApplication.shared.endBackgroundTask(bgTask)         return ("","")}       UIApplication.shared.endBackgroundTask(bgTask)       return ((ctCarrier?.mobileCountryCode ?? ""), (ctCarrier?.mobileNetworkCode ?? ""))             }
Jun ’21