Skip to content

Commit 88028e2

Browse files
authored
Fix radioacesstechnology api deprecated for ios 12.0 or newer (#4960)
* update radio access technology for ios 13 * set version check to 12.0 * styled * change empty check of dict
1 parent 65dafbb commit 88028e2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

GoogleDataTransport/GDTCORLibrary/GDTCORPlatform.m

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,18 @@ GDTCORNetworkMobileSubtype GDTCORNetworkMobileSubTypeMessage() {
7171
};
7272
networkInfo = [[CTTelephonyNetworkInfo alloc] init];
7373
});
74-
NSString *networkCurrentRadioAccessTechnology = networkInfo.currentRadioAccessTechnology;
74+
NSString *networkCurrentRadioAccessTechnology;
75+
if (@available(iOS 12, *)) {
76+
NSDictionary<NSString *, NSString *> *networkCurrentRadioAccessTechnologyDict =
77+
networkInfo.serviceCurrentRadioAccessTechnology;
78+
if (networkCurrentRadioAccessTechnologyDict.count) {
79+
// In iOS 12, multiple radio technologies can be captured. We prefer not particular radio
80+
// tech to another, so we'll just return the first value in the dictionary.
81+
networkCurrentRadioAccessTechnology = networkCurrentRadioAccessTechnologyDict.allValues[0];
82+
}
83+
} else {
84+
networkCurrentRadioAccessTechnology = networkInfo.currentRadioAccessTechnology;
85+
}
7586
if (networkCurrentRadioAccessTechnology) {
7687
NSNumber *networkMobileSubtype =
7788
CTRadioAccessTechnologyToNetworkSubTypeMessage[networkCurrentRadioAccessTechnology];

0 commit comments

Comments
 (0)