通过命令行在iPhone设备中安装应用程序

问题描述 投票:0回答:8

我正在使用

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

command-line xcodebuild
8个回答
20
投票

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


5
投票

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


4
投票

使用这个漂亮的脚本: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();

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


2
投票

这个怎么样:

如何使用命令行将ipa/app文件安装到iPhone中?

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


1
投票

ipatoolhttps://github.com/majd/ipatool

第1步:搜索应用程序包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 

简单!


1
投票

在 MAC 上安装以下软件包

brew install libimobiledevice  
brew install ideviceinstaller 

成功安装以上软件包后。

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

ideviceinstaller -i <Path_to_your_ipa>

谢谢


0
投票

如果您正在编写 Flutter 应用程序,请按照 flutter.dev 上的 这些说明 设置您选择的 IDE(包括在 XCode 中设置签名密钥)。 在 IDE 中运行后,您可以通过以下步骤在连接的设备上构建并启动应用程序:

  • 通过运行
    flutter devices
    查找您的设备 ID,然后复制第二列中列出的十六进制字符串。
  • 从项目的源目录中,运行:
    flutter -d DEVICE_ID run --release
    (或将
    --release
    更改为
    --debug
    以构建和部署调试版本)。

flutter 命令将处理生成 XCode 来编译应用程序。 它的运行速度不会比 XCode 通常运行的速度快(根据我的经验。)

无论是通过 USB 数据线还是通过共享无线网络,请务必保持设备与 Mac 的连接。

© www.soinside.com 2019 - 2024. All rights reserved.