有的時候,咱們可能須要將別人的Xcode運行以後的程序包(xxx.app)安裝在本身的模擬器上,以下我將介紹如何經過終端來安裝。xcode
實現app
獲取本身Xcode生成的xxx.app工具
steps 1:在工程didFinishLaunchingWithOptions:方法中打印bundle路徑:.net
NSLog(@"%@", [[NSBundlemainBundle] pathForAuxiliaryExecutable:@""]);code
steps 2:拷貝打印的bundle路徑,而後點擊桌面->選擇屏幕上方工具欄上的前往->選擇前往文件夾:ip
steps 3:將拷貝的路徑粘貼在前往文件夾路徑中,點擊回車便可:ci
安裝別人Xcode生成的xxx.appget
steps 1:打開終端it
steps 2:在終端輸入xcrun simctl install booted xxx.app路徑,點擊回車。注意,xxx.app路徑爲你須要安裝到模擬器中的app的路徑,獲取方法直接將其拖入終端便可。這裏有個小技巧,可先複製xcrun simctl install booted粘貼到終端,而後再將xxx.app拖入到終端,二者之間以空格隔開。io
Tips
若是沒有安裝Command Line Tool,系統會自動提示安裝,點擊install便可。
異常問題
一、xcrun simctl install booted /path/xxx.app
二、xcrun: error: unable to find utility 「simctl」, not a developer tool or in PATH`
xcrun simctl install booted /path/xxx.app
三、xcrun: error: active developer path (「/Volumes/Xcode/Xcode.app/Contents/Developer」) does not exist, usexcode-select –switch path/to/Xcode.app to specify the Xcode that you wish to use for command line developer tools (or seeman xcode-select)
No devices are booted`
這些問題將會致使安裝不成功,若是沒有安裝上可執行下面的操做。
解決方案
steps 1:獲取Xcode路徑。獲取Xcode路徑只需到應用程序中找到Xcode,而後將其拖入到終端便可獲取到Xcode的路徑。
steps 2:在終端中繼續輸入sudo xcode-select -switch Xcode路徑/Contents/Developer便可。
Tips
好比個人Xcode路徑爲:/Applications/Xcode.app。那麼我在終端中則會輸入爲:sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer