UIAutomation Instrument 异常“目标应用程序不是最前面的”

发布于 2024-12-24 01:38:02 字数 410 浏览 2 评论 0原文

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

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

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

Target app is not frontmost

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

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

I have an iOS5 iPad app that uses CLLocationManager that I'm testing with UIAutomation.

Before I run my test script, I manually press "OK" on the dialog that iOS presents when I use CLLocationManager.

Occassionally, my test scripts will fail to start. I press the "Play" icon in Instruments, and nothing happens for 12 seconds. Then, I get the following exception:

Target app is not frontmost

Once this happens, I usually have to restart to get instruments to work again.

I used to get this same exception when I left the CLLocationManager dialog in front of my application. Does anyone have any idea about how to fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

请帮我爱他 2024-12-31 01:38:02
    //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 
    //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 
狠疯拽 2024-12-31 01:38:02

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

This happens when an alert view pops up before the app finishes launching fully. It's a bug with automation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文