【问题标题】:Run Instruments 4.3 from the cmd line?从 cmd 行运行 Instruments 4.3?
【发布时间】:2012-05-05 11:22:45
【问题描述】:

我在从 cmd 行运行 Instruments 4.3 时遇到问题。我相信它正在使用我仍然安装的旧 4.2 版本。如何让 Instruments 4.3 安装并启动我的应用程序,然后对其运行 UIAutomation?

【问题讨论】:

    标签: ios instruments ui-automation ios-ui-automation


    【解决方案1】:

    你试过了吗:/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/MacOS/Instruments

    这个怎么样: /Applications/Xcode.app//Contents/Developer/usr/bin/instruments

    【讨论】:

    • 从包中打开应用程序。我想知道“仪器”命令行命令在哪里,或者它现在是否已被弃用或什么。
    • 哦等等!我只是在首选项窗格中查看了下载,似乎我还没有下载命令行工具!
    • 不,那也没用!我不断收到:“仪器使用错误:设备无法准备好使用。”
    • 我错过了您的编辑,这也可能有效。我仍然不断收到设备未准备好错误。 :(
    【解决方案2】:

    我想我已经弄清楚了,但我仍然遇到问题。我从首选项安装命令行工具 -> 下载并运行

    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。我不断收到:“仪器使用错误:设备无法准备好使用。”那么什么给了??

    【讨论】:

      【解决方案3】:

      问题在于您指定了-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 参数,它应该可以正常工作。

      【讨论】:

      • 像魅力一样工作!再次感谢!
      猜你喜欢
      • 2012-10-19
      • 2012-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-21
      • 1970-01-01
      相关资源
      最近更新 更多