Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/115.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 UIAutomation Instrument Exception“;目标应用程序不是最前面的“应用程序”;_Ios_Ios Simulator_Instruments_Cllocationmanager_Ios Ui Automation - Fatal编程技术网

Ios UIAutomation Instrument Exception“;目标应用程序不是最前面的“应用程序”;

Ios UIAutomation Instrument Exception“;目标应用程序不是最前面的“应用程序”;,ios,ios-simulator,instruments,cllocationmanager,ios-ui-automation,Ios,Ios Simulator,Instruments,Cllocationmanager,Ios Ui Automation,我有一个iOS5 iPad应用程序,它使用CLLocationManager,我正在用UIAutomation进行测试 在运行测试脚本之前,我手动按下iOS在使用CLLocationManager时显示的对话框上的“OK” 有时,我的测试脚本将无法启动。我在仪器中按下“播放”图标,12秒钟内什么也没发生。然后,我得到以下异常: Target app is not frontmost 一旦发生这种情况,我通常必须重新启动才能使仪器再次工作 当我离开应用程序前面的CLLocationManager

我有一个iOS5 iPad应用程序,它使用
CLLocationManager
,我正在用
UIAutomation
进行测试

在运行测试脚本之前,我手动按下iOS在使用CLLocationManager时显示的对话框上的“OK”

有时,我的测试脚本将无法启动。我在
仪器
中按下“播放”图标,12秒钟内什么也没发生。然后,我得到以下异常:

Target app is not frontmost
一旦发生这种情况,我通常必须重新启动才能使仪器再次工作


当我离开应用程序前面的
CLLocationManager
对话框时,我也会遇到同样的异常。有人知道如何解决这个问题吗?

当应用程序完全启动前弹出警报视图时,就会发生这种情况。这是一个自动化错误。

处理警报要删除此错误,请参阅自动化用户界面\u使用\u仪器测试\u pdf
    //Handling Externally Generated Alerts
UIATarget.onAlert = function onAlert(alert) {
    var title = alert.name();
    UIALogger.logWarning("Alert with title ’" + title + "’ encountered!");
    if (title == "Add Something") {
        alert.buttons()["Add"].tap();
        return true; // bypass default handler
    }
    return false; // use default handler
}

Use this code to handle location alert