fix(ios): fix deprecation warnings for iOS 12+#169
Conversation
- `currentRadioAccessTechnology` is deprecated since iOS 12: https://developer.apple.com/documentation/coretelephony/cttelephonynetworkinfo/currentradioaccesstechnology?language=objc.`serviceCurrentRadioAccessTechnology` should be used. - Add method `currentRadioAccessTechnology` which uses `serviceCurrentRadioAccessTechnology` on iOS 12 and newer and `currentRadioAccessTechnology` on iOS 11 and older - `CTRadioAccessTechnologyDidChangeNotification` is deprecated since iOS 12: https://developer.apple.com/documentation/coretelephony/ctradioaccesstechnologydidchangenotification?language=objc. Instead `CTServiceRadioAccessTechnologyDidChangeNotification` should be used.
There was a problem hiding this comment.
Pull request overview
Updates the iOS implementation of the network-information plugin to avoid CoreTelephony deprecation warnings on iOS 12+ while preserving legacy behavior on older iOS versions.
Changes:
- Replace direct use of deprecated
currentRadioAccessTechnologywith an internal helper that usesserviceCurrentRadioAccessTechnologyon iOS 12+. - Switch CoreTelephony radio technology change observation to
CTServiceRadioAccessTechnologyDidChangeNotificationon iOS 12+ with a deprecated fallback on older iOS versions.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- serviceCurrentRadioAccessTechnology is a dictionary (multi‑SIM). Using allValues.firstObject is non-deterministic and can report the wrong Radio Access Technology when multiple services exist. Prefer selecting the Radio Access Technology for the active data service (e.g., via dataServiceIdentifier when available) and fall back deterministically when it’s not. - Generated-By: GitHub Copilot AI
|
If evertyhing ok with this? I would like to merge it and start to make a release to make this plugin work again with XCode 26.4 |
- Use local variable `radioAccessTechnology` for check
|
I merged the 5G change into it and adjusted it |
Yah I think this repo has a lot of fixes that have been sitting in master that should be pushed to an actual release. Once a patch is released, I think we should consider doing a major bump to then clean up some of the code, requiring cordova-ios@8, which is a min iOS 13 support... we can then clean up some of the backwards compatibility stuff. Not sure if there any anything worth cleaning on the android side, but a 4.x target would be the time to do it. |
Yes this sounds good. |
Platforms affected
iOS
Motivation and Context
Description
currentRadioAccessTechnologywhich usesserviceCurrentRadioAccessTechnologyon iOS 12 and newer andcurrentRadioAccessTechnologyon iOS 11 and olderserviceCurrentRadioAccessTechnologyis a dictionary (multi‑SIM). On iOS 13+ the active sim for mobile data is used by using telephonyInfo.dataServiceIdentifier.Testing
Checklist
(platform)if this change only applies to one platform (e.g.(android))