Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIStatusBarSignalStrengthHitemView和signalStrengthRaw用于计算单元格信号强度,不更新背景中的值_Ios_Objective C_Iphone Privateapi_Signal Strength_Background Mode - Fatal编程技术网

Ios UIStatusBarSignalStrengthHitemView和signalStrengthRaw用于计算单元格信号强度,不更新背景中的值

Ios UIStatusBarSignalStrengthHitemView和signalStrengthRaw用于计算单元格信号强度,不更新背景中的值,ios,objective-c,iphone-privateapi,signal-strength,background-mode,Ios,Objective C,Iphone Privateapi,Signal Strength,Background Mode,我们使用私有框架(包括uistatusbarsignalstrenghthitemview.h)来计算小区信号强度。 它在前台模式下工作得很好,但一旦我的应用程序进入后台,它就会停止更新手机信号强度 我们使用的代码是: UIApplication *app = [UIApplication sharedApplication]; NSArray *subviews = [[[app valueForKey:@"statusBar"] valueForKey:@"foregroundView"]

我们使用私有框架(包括uistatusbarsignalstrenghthitemview.h)来计算小区信号强度。 它在前台模式下工作得很好,但一旦我的应用程序进入后台,它就会停止更新手机信号强度

我们使用的代码是:

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];
请注意,我们将应用程序用于企业目的,因此我们不必担心苹果拒绝使用私有框架


非常感谢您的帮助。

在后台状态下,
[app valueForKey:@“statusBar”]
将等于零。这是因为无法从bg访问应用程序中的状态栏。

在后台状态下,
[app valueForKey:@“statusBar”]
将等于零。这是因为无法从bg访问应用程序中的状态栏