【发布时间】:2012-05-05 11:22:45
【问题描述】:
我在从 cmd 行运行 Instruments 4.3 时遇到问题。我相信它正在使用我仍然安装的旧 4.2 版本。如何让 Instruments 4.3 安装并启动我的应用程序,然后对其运行 UIAutomation?
【问题讨论】:
标签: ios instruments ui-automation ios-ui-automation
我在从 cmd 行运行 Instruments 4.3 时遇到问题。我相信它正在使用我仍然安装的旧 4.2 版本。如何让 Instruments 4.3 安装并启动我的应用程序,然后对其运行 UIAutomation?
【问题讨论】:
标签: ios instruments ui-automation ios-ui-automation
你试过了吗:/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/MacOS/Instruments
这个怎么样:
/Applications/Xcode.app//Contents/Developer/usr/bin/instruments
【讨论】:
我想我已经弄清楚了,但我仍然遇到问题。我从首选项安装命令行工具 -> 下载并运行
xcode-select -switch /Applications/Xcode.app/Contents/Developer
然后我跑了:
xcrun instruments -v -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w /Users/cliff/Src/MyApp/build/MyApp/Build/Products/Debug-iphoneos/MyApp.app -e UIASCRIPT /Users/cliff/Src/MyApp/UIAutomation/automation-test.js -e UIARESULTSPATH /Users/cliff/Src/MyApp/build/uiautomation
我很确定这会选择当前版本的 Instruments 命令行工具,因为我还将 /Developer 文件夹移出 PATH。我不断收到:“仪器使用错误:设备无法准备好使用。”那么什么给了??
【讨论】:
问题在于您指定了-w 参数但没有提供设备ID。如果您尝试在模拟器中从您的应用程序运行,那么只需像这样省略-w。
xcrun instruments -v \
-t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate \
/Users/cliff/Src/MyApp/build/MyApp/Build/Products/Debug-iphoneos/MyApp.app \
-e UIASCRIPT /Users/cliff/Src/MyApp/UIAutomation/automation-test.js \
-e UIARESULTSPATH /Users/cliff/Src/MyApp/build/uiautomation
如果您真的想在设备上运行这个自动化脚本,那么您可以使用this script I wrote 快速获取设备 ID。将该 ID 交给 -w 参数,它应该可以正常工作。
【讨论】: