gpt4 book ai didi

ios - UIAutomation 仪器异常 "Target app is not frontmost"

转载 作者:可可西里 更新时间:2023-11-01 04:44:43 26 4
gpt4 key购买 nike

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

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

有时,我的测试脚本会无法启动。我按下 Instruments 中的“播放”图标,12 秒内没有任何反应。然后,我得到以下异常:

Target app is not frontmost

一旦发生这种情况,我通常必须重新启动才能让仪器再次工作。

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

最佳答案

    //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

关于ios - UIAutomation 仪器异常 "Target app is not frontmost",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8680997/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com