Signal strength in ios 8.3

2019-08-10 07:34发布

问题:

Apple has restricted API to fetch signal strength but there is a way to get this i found here.Is it a correct way to get signal strength. I am developing for iTunes store submission. Will apple reject my app? Solution provided by @Mateusz Mirkowski as follow :

UIApplication *app = [UIApplication sharedApplication];
NSArray *subviews = [[[app valueForKey:@"statusBar"]     valueForKey:@"foregroundView"] subviews];
NSString *dataNetworkItemView = nil;


     for (id subview in subviews) {
   if([subview isKindOfClass:[NSClassFromString(@"UIStatusBarSignalStrengthItemView") class]])
   {
        dataNetworkItemView = subview;
        break;
    }
 }
int signalStrength = [[dataNetworkItemView valueForKey:@"signalStrengthRaw"] intValue];

NSLog(@"signal %d", signalStrength);

回答1:

If you are using anything that Apple does not allow, it will certainly leads to the App rejection.