使用 UIAutomation 的仪器出现意外错误

发布于 2024-09-14 22:39:38 字数 760 浏览 8 评论 0原文

我目前正在使用 IOS SDK 4.0.2 并学习如何进行 UIAutomation。不幸的是,我发现在模拟器中,当我尝试运行简单的 Java 脚本测试(仅分配变量)时,出现以下错误。

Unexpected error in -[UIATarget_0x5d04f60 frontMostApp], /SourceCache/UIAutomation_Sim/UIAutomation-37/Framework/UIATargetElements.m line 437,

这是我试图运行的“脚本”

   function iDontDoAnything() {
      var target = UIATarget.localTarget();
      var app = target.frontMostApp();
      var navBar = app.navigationBar();
      UIALogger.logPass("it passed");
}

  UIALogger.logStart("First Tester Test");
  iDontDoAnything();

,我发现这是因为调用 frontMostApp() 时返回 null。测试在 4.0.2 的实际设备上运行良好/通过。

主要问题:4.0.2在模拟器上有办法解决这个问题吗?我已经注意到了存在此问题的早期版本(4.0.1)的解决方案 - 尝试过但没有成功。

目前还没有太多文档,任何建议将不胜感激!

劳伦

I am currently using IOS SDK 4.0.2 and learning how to do UIAutomation. Unfortunately I found that in the Simulator, when I try running a simple Java script test (that just assigns variables) I get the following error.

Unexpected error in -[UIATarget_0x5d04f60 frontMostApp], /SourceCache/UIAutomation_Sim/UIAutomation-37/Framework/UIATargetElements.m line 437,

Here is the "Script" I was trying to run

   function iDontDoAnything() {
      var target = UIATarget.localTarget();
      var app = target.frontMostApp();
      var navBar = app.navigationBar();
      UIALogger.logPass("it passed");
}

  UIALogger.logStart("First Tester Test");
  iDontDoAnything();

And I figured out that this is because I am getting a null returned when frontMostApp() is called. The test runs fine/passes on the actual device with 4.0.2.

Main Question: Is there a way to solve this problem in 4.0.2 on the simulator? I have noted a solution for the earlier version (4.0.1) that had this problem - tried it with no success.

Not much documentation out there yet, any advice would be much appreciated!

Lauren

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

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

发布评论

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

评论(1

琴流音 2024-09-21 22:39:38

你检查模拟器是否有accessibility.plist吗?

我在 https://devforums.apple.com/message/261883#261883 上找到了这个他们建议:“将 ~/Library/Application Support/iPhone Simulator/4.0/Library/Preferences/com.apple.Accessibility.plist 复制到 ~/Library/Application Support/iPhone Simulator/4.0.1/Library/Preferences”并且它有效为我。

Did you check if simulator has the accessibity.plist?

I found this on https://devforums.apple.com/message/261883#261883 they recommend: "Copy ~/Library/Application Support/iPhone Simulator/4.0/Library/Preferences/com.apple.Accessibility.plist to ~/Library/Application Support/iPhone Simulator/4.0.1/Library/Preferences" and it worked for me.

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