1

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!

Nirav Jain
  • 5,088
  • 5
  • 40
  • 61
Rahul Sharma
  • 940
  • 2
  • 12
  • 31
  • 1
    Your code is using a kind-of private API and hence is not intended to work reliably. See https://stackoverflow.com/questions/46462712/ios-11-cellular-signal-strength – Andreas Oetjen Jun 06 '18 at 07:20

0 Answers0