2017-08-11 85 views
1

我想要做的就是能够做与Cmd + R相同的事情,我可以在Xcode中做到这一点,终端除外。但到目前为止看看多个堆栈溢出帖子和文章已经让我失去了。如何在命令行模拟器上构建&运行xcodeproj?

到目前为止,我已经能够运行在命令行模拟器:

open -a Simulator --args -CurrentDeviceUDID <UDID for iPhone 7> 

但我已经无法使用这些命令来安装和启动应用程序

xcrun simctl install booted <PATH-TO-APPLICATION-BUNDLE> 
xcrun simctl launch booted <BUNDLE-ID-OF-APP-BUNDLE> 

我不知道如何找到<PATH-TO-APPLICATION-BUNDLE>。我假设它不是那么容易,因为只把路径.xcodeproj ...

如果任何人都可以写的步骤&我需要(1)建立.xcodeproj从命令行和(2)运行应用程序特定的命令从命令行模拟器上,将不胜感激!

P.S.我知道有像ios-sim工具,可能使整个过程更容易,但我想这样做生(即使用Xcode中的命令行工具)

+0

构建之后..你知道你是在哪里.app文件? –

回答

1

(1)建立你的项目,我建议你检查此链接 https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html

(2)这是我如何模拟器上发起的应用程序

列表装置

xcrun simctl list 

一个例子引导设备

(例如)

xcrun simctl boot "iPhone 5" 

或 (例如)

xcrun simctl boot E9469085-68B9-450A-A716-87F013C9AF56 

安装的.app(要找到你的库文件夹..可以隐藏)

格式:xcrun simctl install <设备> <。应用程序路径> (实施例)

xcrun simctl install "iPhone 5" "MyUserPath/Library/Developer/Xcode/DerivedData/CustomTransitions-edghiwbzifosladnxssmsfwzykxg/Build/Products/Debug-iphonesimulator/CustomTransitions.app" 

关断装置

xcrun simctl boot "iPhone 5" 

打开模拟器(这是我的路径..你可以不同)

open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app 

启动应用程序

格式:xcrun simctl推出引导<包ID>

xcrun simctl launch booted "com.example.apple-samplecode.CustomTransitions" 
相关问题