I am new to Objective-C. I have problem with following code. it shows 'currentRadioAccessTechnology' is deprecated: first deprecated in iOS 12.0 and Replace 'currentRadioAccessTechnology' with 'serviceCurrentRadioAccessTechnology' If i replace my code. It gives following error No visible @interface for 'NSDictionary<NSString *,NSString *>' declares the selector 'isEqualToString:'
- (NSString*)w3cConnectionTypeFor:(CDVReachability*)reachability
{
NetworkStatus networkStatus = [reachability currentReachabilityStatus];
switch (networkStatus) {
case NotReachable:
return @"none";
case ReachableViaWWAN:
{
BOOL isConnectionRequired = [reachability connectionRequired];
if (isConnectionRequired) {
return @"none";
} else {
if ([[[UIDevice currentDevice] systemVersion] compare:@"7.0" options:NSNumericSearch] != NSOrderedAscending) {
CTTelephonyNetworkInfo *telephonyInfo = [CTTelephonyNetworkInfo new];
if ([telephonyInfo.serviceCurrentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyGPRS]) {
return @"2g";
} else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyEdge]) {
return @"2g";
} else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyWCDMA]) {
return @"3g";
} else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyHSDPA]) {
return @"3g";
} else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyHSUPA]) {
return @"3g";
} else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMA1x]) {
return @"3g";
} else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORev0]) {
return @"3g";
} else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORevA]) {
return @"3g";
} else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORevB]) {
return @"3g";
} else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyeHRPD]) {
return @"3g";
} else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyLTE]) {
return @"4g";
}
}
return @"cellular";
}
}
case ReachableViaWiFi:
{
BOOL isConnectionRequired = [reachability connectionRequired];
if (isConnectionRequired) {
return @"none";
} else {
return @"wifi";
}
}
default:
return @"unknown";
}
}
serviceCurrentRadioAccessTechnologyis a dictionary, not a string since devices may have dual SIMs and therefore more than one carrier. You need to get the value from each dictionary entry. Retrieve the dictionary keys and use that to access the service types. - Paulw11