How to detect the 5G(NR) on iOS14?

2.7k Views Asked by At

Apple will release the iPhone12 in this year, and the iPhone12(some higher device type) can support the 5G feature, I think the iPhone12 should be based on iOS14 platform, so I looked into the iOS14 APIs, but we can't find any new APIs about the 5G. Does anybody know the some information about 5G detection of the iPhone12?

Appreciated for the information from anybody!

iOS14 API diff: https://developer.apple.com/documentation/technologies?changes=latest_major

1

There are 1 best solutions below

10
On

Probably you should be looking into CTTelephonyNetworkInfo, where you'll find serviceCurrentRadioAccessTechnology, as well as currentRadioAccessTechnology. That should offer you what you want.

However, I wouldn't be able to tell you what the key or value for 5G will be. Given they're all Strings though, a new one could just show up and probably a future version of Xcode 12 would add a property to strong type it.

For reference, this SO answer shows how to identify 2G, 3G and 4G.

Later update: Core Telephony Constants has shown up and provides 2 new strings, CTRadioAccessTechnologyNR and CTRadioAccessTechnologyNRNSA, both available from iOS 14+ (reasonable given iPhone 12s are first with the tech). This should be reinforced by the term NR, which seems to be part of 5Gs naming 5G NR (New Radio). I don't have a phone to test today, so still yet to confirm where this property will show up, but I'd still guess within CTTelephonyNetworkInfo().serviceCurrentRadioAccessTechnology.

For reference, to test this, you need to import CoreTelephony.

Latest update:

Big thanks to Alessandro Martin for sharing this in the comment:

There's a mistake on Apple's part as the CTRadioAccessTechnologyNR and CTRadioAccessTechnologyNRSA strings are marked as available from iOS 14.0 but in fact it should be iOS 14.1 Take into account that a user on iOS 14.2 beta will pass the availability check but it will crash with a null pointer exception when trying to access these strings as they are not available to them.