2011-09-20 122 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

我不相信它,它可以工作,開箱即用,無需設置,令人驚歎。 –

相關問題