简体   繁体   English

我们可以在iPhone模拟器中使用UI自动化工具吗?

[英]Can we use UI Automation tools with the iPhone Simulator?

I've been using the new UI automation tools with Instruments and the iPhone SDK 4.0, but so far I haven't been able to get it to run under the iPhone Simulator. 我一直在使用仪器和iPhone SDK 4.0的新UI自动化工具,但到目前为止我还没能在iPhone模拟器下运行它。 I've tried setting the target to every location possible—my build folder, the app folder in ~/Library/Application Support/iPhone Simulator, etc.—but I get an error message when I try to run it: 我已经尝试将目标设置到每个可能的位置 - 我的构建文件夹,〜/ Library / Application Support / iPhone Simulator中的app文件夹等 - 但是当我尝试运行它时收到错误消息:

Unexpected error in -[UIATarget_0x5a1e3b0 frontMostApp], /SourceCache/UIAutomation_Sim/UIAutomation-37/Framework/UIATargetElements.m line 437, 出现意外错误 - [UIATarget_0x5a1e3b0 frontMostApp],/ SourceCache / UIAutomation_Sim / UIAutomation-37 / Framework /UIATargetElements.m第437行,

Has anyone gotten this to work? 有没有人得到这个工作?

Yes in theory you can. 理论上你可以。 In practice there are a lot of problems. 在实践中存在很多问题。 But did you check if simulator has the accessibity.plist? 但是你检查过模拟器是否有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. 我在https://devforums.apple.com/message/261883#261883上发现了这一点,他们建议:“复制〜/ Library / Application Support / iPhone Simulator / 4.0 / Library / Preferences / com.apple.Accessibility.plist to~ /库/应用程序支持/ iPhone模拟器/ 4.0.1 /库/首选项“它对我有用。

If you have trouble getting the correct target, running your project with a different instrument (like Leaks) should put your executable into the "choose target" list. 如果您无法获得正确的目标,则使用其他工具(如Leaks)运行项目时应将可执行文件放入“选择目标”列表中。 That is at least one potential error source you can exclude that way. 这至少是一个可以排除这种方式的潜在错误来源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM