使用 UIAutomation 的仪器出现意外错误
我目前正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你检查模拟器是否有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.