有的时候,咱们可能须要将别人的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