【问题标题】:install application in iphone device through command line通过命令行在 iphone 设备中安装应用程序
【发布时间】:2013-04-04 00:04:43
【问题描述】:

我正在使用xcodebuild install -alltargets -iphoneos4.2 -activeconfiguration provisioning_profile=path_of_my_provisioningprofile code_sign_identity=identity。 该命令正在构建我的应用程序,我也正在获取构建文件(.app)。 但是如何从命令行将应用程序安装到设备中。 请帮助我解决这个问题。

【问题讨论】:

    标签: command-line xcodebuild


    【解决方案1】:

    Fruitstrap 不再维护,要获得更新的项目,请查看 PhoneGap 的分支 ios-deploy

    要安装运行:npm install -g ios-deploy

    以下是一些如何使用它的示例:

    // deploy and debug your app to a connected device
    ios-deploy --debug --bundle my.app
    
    // deploy and launch your app to a connected device, but quit the debugger after
    ios-deploy --justlaunch --debug --bundle my.app
    
    // deploy and launch your app to a connected device, quit when app crashes or exits
    ios-deploy --noninteractive --debug --bundle my.app
    
    // Upload a file to your app's Documents folder
    ios-deploy --bundle_id 'bundle.id' --upload test.txt --to Documents/test.txt
    

    【讨论】:

    • 谢谢!我使用 iOS 9.3.1 和 OS X 10.11.3 进行了工作设置
    • 在一个经常过时的世界中提供现代、有效的答案。干杯!
    • 我不相信。有用。盒子外面。无需设置。太棒了。
    • 安装运行良好,但调试不成功:error: python failed attempting to evaluate 'fruitstrap_device_app="/private/var/containers/Bundle/Application/...
    【解决方案2】:
    【解决方案3】:

    使用这个漂亮的脚本:http://gamua.com/blog/2012/03/how-to-deploy-ios-apps-to-the-iphone-via-the-command-line/ - 然后通过 usb 将 iphone 设备连接到运行此命令的 mac

    在命令行上启动应用程序:

    instruments -w 4xxxxxxxx9 -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate NITC -e UIASCRIPT Launch-App.js
    

    格式:instruments -w <deviceid> -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate <applicationname> -e UIASCRIPT Launch-App.js

    我的 Launch-App.js 只有一行 - var target = UIATarget.localTarget();

    这必须足以使用命令行在设备上启动应用程序

    【讨论】:

    • 哇,我从未见过在将应用程序或 IPA 推送到设备时提到的工具 - +1。有没有办法让仪器列出与-w 一起使用的设备 ID?
    • @noloader +1 了解如何列出设备 ID,我很想知道。
    • Fruitstrap(链接使用的)现在已被废弃,不适用于 iOS 7 :(
    • 如果有人遇到这个问题并且仍然想知道设备 ID:instruments -s devices
    • 这不适用于 Xcode 9.1 — 我似乎没有 AutomationInstrument.bundle
    【解决方案4】:

    环顾四周发现https://github.com/benvium/libimobiledevice-macosx。这是一个从 libimobiledevice 到 MAC-OS X 的端口。它非常有用,不需要越狱。 :P

    【讨论】:

    • 谢谢@santiagoRodriguez:p
    【解决方案5】:

    这个呢:

    how to intall an ipa/app file into iPhone with command line?

    使用 libimobiledevice 的第三种解决方案。

    【讨论】:

      【解决方案6】:

      ipatoolhttps://github.com/majd/ipatool

      第 1 步:搜索 app bundle id

       ./ipatool search testflight --limit 1
      
      > ==> ℹ️    [Info] Searching for 'testflight' using the 'US' store front...
      > ==> ℹ️    [Info] Found 1 result:
      > 1. TestFlight: com.apple.TestFlight (3.1.0).
      

      第 2 步:下载 IPA

      ./ipatool download --bundle-identifier com.apple.TestFlight 
      

      简单!

      【讨论】:

        【解决方案7】:

        在 MAC 上安装以下软件包

        brew install libimobiledevice  
        brew install ideviceinstaller 
        

        成功安装以上包后。

        使用以下命令在 iOS 设备上安装 .ipa 文件:

        ideviceinstaller -i <Path_to_your_ipa>
        

        谢谢

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2013-10-18
          • 2011-02-21
          • 2016-01-24
          • 2013-03-30
          • 1970-01-01
          • 1970-01-01
          • 2010-09-19
          相关资源
          最近更新 更多