@@ -129,9 +129,28 @@ static firebase_perf_v1_NetworkConnectionInfo_MobileSubtype FPRCellularNetworkTy
129129 };
130130 });
131131
132- NSString *networkString = FPRNetworkInfo ().currentRadioAccessTechnology ;
133- NSNumber *cellularNetworkType = cellularNetworkToMobileSubtype[networkString];
134- return cellularNetworkType.intValue ;
132+ // Use recent APIs for iOS 12 and above and older APIs for before.
133+ if (@available (iOS 12 , *)) {
134+ NSDictionary <NSString *, NSString *> *radioAccessors =
135+ FPRNetworkInfo ().serviceCurrentRadioAccessTechnology ;
136+ if (radioAccessors.count > 0 ) {
137+ NSString *networkString = [radioAccessors.allValues objectAtIndex: 0 ];
138+ NSNumber *cellularNetworkType = cellularNetworkToMobileSubtype[networkString];
139+ return cellularNetworkType.intValue ;
140+ }
141+ } else {
142+ #pragma clang diagnostic push
143+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
144+
145+ NSString *networkString = FPRNetworkInfo ().currentRadioAccessTechnology ;
146+
147+ #pragma clang diagnostic pop
148+
149+ NSNumber *cellularNetworkType = cellularNetworkToMobileSubtype[networkString];
150+ return cellularNetworkType.intValue ;
151+ }
152+
153+ return firebase_perf_v1_NetworkConnectionInfo_MobileSubtype_UNKNOWN_MOBILE_SUBTYPE;
135154}
136155#endif
137156
@@ -218,12 +237,6 @@ firebase_perf_v1_ApplicationInfo FPRGetApplicationInfoMessage(void) {
218237 iosAppInfo.has_network_connection_info = true ;
219238 iosAppInfo.network_connection_info .has_network_type = true ;
220239#ifdef TARGET_HAS_MOBILE_CONNECTIVITY
221- CTTelephonyNetworkInfo *networkInfo = FPRNetworkInfo ();
222- CTCarrier *provider = networkInfo.subscriberCellularProvider ;
223- NSString *mccMnc = FPRValidatedMccMnc (provider.mobileCountryCode , provider.mobileNetworkCode );
224- if (mccMnc) {
225- iosAppInfo.mcc_mnc = FPREncodeString (mccMnc);
226- }
227240 if (iosAppInfo.network_connection_info .network_type ==
228241 firebase_perf_v1_NetworkConnectionInfo_NetworkType_MOBILE) {
229242 iosAppInfo.network_connection_info .mobile_subtype = FPRCellularNetworkType ();
0 commit comments