Radio Access Technology Constants

We are checking for cellular mode using the code below.

When the code below is executed, is it correct to convey the status value of the actually connected cellular environment?

Sometimes HSDPA or WCDMA is output.

I would like to inquire under what conditions the value is output.

[Code] func getCellularConnectionType() -> String { if #available(iOS 14.1, *) { if let radioAccessTechnology = networkInfo.serviceCurrentRadioAccessTechnology?.values.first { Debug.log("Radio Access Technology: (radioAccessTechnology)") switch radioAccessTechnology { case CTRadioAccessTechnologyLTE: return "LTE" case CTRadioAccessTechnologyNRNSA: return "5G-NSA" case CTRadioAccessTechnologyNR: return "5G-SA" default: return "ETC" } } } return "Cellular" }

Answered by DTS Engineer in 816633022

I don’t think there’s a good answer here. This API is very straightforward. If it’s giving you seemingly impossible results then there’s not much you can do about it at the API level. Your only real option is to file a bug requesting that Apple either fix the API or document why it gives you the results that it does.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

When posting code examples, please use the Code Block formatting style, like this:

func getCellularConnectionType() -> String {
    return "This is readable now."
}

Thank you. I'm sharing the code again.

[Code]

func getCellularConnectionType() -> String {
        if #available(iOS 14.1, *) {
            if let radioAccessTechnology = networkInfo.serviceCurrentRadioAccessTechnology?.values.first {
                Debug.log("Radio Access Technology: \(radioAccessTechnology)")

                switch radioAccessTechnology {
                case CTRadioAccessTechnologyLTE:
                    return "LTE"
                case CTRadioAccessTechnologyNRNSA:
                    return "5G-NSA"
                case CTRadioAccessTechnologyNR:
                    return "5G-SA"
                default:
                    return "ETC"
                }
            }
        }

        return "Cellular"
    }

To give a little more context, we are a carrier that only has LTE and 5G NSAs, but we are getting intermittent HSDPA, WCDPA, etc.

 func getCellularConnectionType() -> String {
    if #available(iOS 14.1, *) {
      if let radioAccessTechnology = networkInfo.serviceCurrentRadioAccessTechnology?.values.first {
        Debug.log("Radio Access Technology: \(radioAccessTechnology)")
        switch radioAccessTechnology {
        case CTRadioAccessTechnologyLTE:
          return "LTE"
        case CTRadioAccessTechnologyNRNSA:
          return "5G-NSA"
        case CTRadioAccessTechnologyNR:
          return "5G-SA"
        default:
          return "ETC"
        }
      }
    }
    return "Cellular"
  }

I don’t think there’s a good answer here. This API is very straightforward. If it’s giving you seemingly impossible results then there’s not much you can do about it at the API level. Your only real option is to file a bug requesting that Apple either fix the API or document why it gives you the results that it does.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Radio Access Technology Constants
 
 
Q