2011-09-20 125 views
20

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

回答

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

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

This mus t足以使用命令行在设备上启动应用程序

+2

哇,我从来没有见过的仪器 - +1 。有没有办法让仪器列出使用'-w'的设备ID? – jww

+0

@noloader +1如何列出设备ID,我很想知道。 –

+1

Fruitstrap(该链接使用的)现在已被放弃,并且不适用于iOS 7 :( – sheeptest

12

Fruitstrap已不再维护,对于更新的项目结帐,PhoneGap的分支名为ios-deploy

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

这里是如何使用它的一些例子:推动应用或IPA到设备时提到

// 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 
+0

谢谢!我的工作设置使用iOS 9.3.1和OS X 10.11.3 – Jespertheend

+3

一个现代化的工作答案经常过时的世界,干杯! – mix3d

+0

我不相信它,它可以工作,开箱即用,无需设置,令人惊叹。 –

相关问题