I am using below mention code to detect the signal strength in the iOS device, This code returns perfect signal strength results in iOS 9 or below version.
UIApplication *app = [UIApplication sharedApplication];
NSArray *subviews = [[[app valueForKey:@"statusBar"]valueForKey:@"foregroundView"] subviews];
NSString *dataNetworkItemView = nil;
if ([CommonUtils objectIsValid:subviews])
{
for (id subview in subviews) {
if([subview isKindOfClass:[NSClassFromString(@"UIStatusBarSignalStrengthItemView") class]])
{
dataNetworkItemView = subview;
break;
}
}
NSInteger checkSignalValue = [[dataNetworkItemView valueForKey:@"signalStrengthRaw"] integerValue];
self.dynamicMessageValue = [NSString stringWithFormat:@"%ld dBm",(long)checkSignalValue];
But in iOS 10 or above version this code is not working every time return 0 value. And I'm also checking on the device through to device keypad dial 3001#12345# then it shows result top on status bar left side but in iOS 9 or below version, above iOS 10 it's not working.
Anyone, please let me know an alternative to get device signal strength?
Please do a post with the proper answer. Thanks!