我试图遵循
this post从命令行在iOS设备上运行UIAutomation脚本,但我无法使其工作.
这是我目前使用的命令:
instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate / Users / X / Library / Developer / Xcode / DerivedData / TestiPhoneAutomation2-dyufpxsavtdqkybpagcoawdudzid / Build / Products / Debug-iphoneos / TestiPhoneAutomation2.app -e UIASCRIPT“/Users/X/Workspaces/TestiPhoneAutomation/test2.js”-e UIARESULTSPATH“/ Users / X / Workspaces / TestiPhoneAutomation2 /”-w 80bf5b … UDID. ..dfb52543 -v
它在模拟器上运行良好(通过Debug-iphonesimulator替换Debug-iphoneos,它在这种情况下也忽略了-w),但是如果我使用为设备编译的应用程序启动它它会崩溃(我尝试使用发布和调试,我得到相同的结果).
我得到的错误是:
posix spawn failure; aborting launch (binary ==
/Users/X/Library/Developer/Xcode/DerivedData/TestiPhoneAutomation2-dyufpxsavtdqkybpagcoawdudzid/Build/Products/Debug-iphoneos/TestiPhoneAutomation2.app/TestiPhoneAutomation2).
2012-10-03 12:10:36.609 instruments[76151:1603] Recording cancelled :
At least one target failed to launch; aborting run Instruments Trace
Error : Failed to start trace.
我得到了同样的错误,但我没有运行多个仪器副本.我通过在应用程序之前放置-w UDID参数,并且仅使用应用程序的名称(已将应用程序部署到设备)来实现此功能.
我使用的命令行如下(使用Xcode 4.6):
instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w <device_id> <app_name> -e UIASCRIPT <path_to_script> -e UIARESULTSPATH <path_to_results>