从终端构建/运行iOS Xcode项目 [英] Build/run iOS Xcode project from Terminal
问题描述
我想从终端构建一个Xcode项目,然后根据需要运行它,也来自终端。
I want to build a Xcode project from Terminal and then run it as required, also from Terminal.
我一直在寻找一种方法来做到这一点虽然现在但只设法找到一个适用于iPhone模拟器的方法,而不是它自己的实际设备。
I have been looking for a way to do this for a while now but only managed to find a method which works for the iPhone Simulator, not for the actual device it self.
这甚至可能吗?我想在终端设备上安装Xcode项目的原因是因为应用程序运行了一系列自动化测试,我更喜欢使用bash脚本自动执行此过程。
Is this even possible? The reason I want to a Xcode project on a device from Terminal is because the application runs a series of automated tests and I would prefer to automate this process using a bash script.
谢谢
推荐答案
要使用bash脚本从命令行构建xcode项目,请使用:
To build your xcode project from the command line using a bash script use:
/usr/bin/xcodebuild -target TargetYouWantToBuild -configuration Debug
查看xcodebuild的手册页以获取更多选项。
Look at the man page for xcodebuild for more options.
我们为单元测试套件目标执行此操作,并使用GHUnit。
We do this for our unit test suite target, and we use GHUnit.
这是我们用于运行测试的构建脚本的一部分:
This is the section of our build script for running the tests:
export GHUNIT_CLI=1
export WRITE_JUNIT_XML=1
clean
echo "Building Bamboo GHUnit Tests..."
OUTPUT=`/usr/bin/xcodebuild -target BambooAutomatedUnitTest -configuration Debug -sdk iphonesimulator4.3 build`
RESULT=`echo "$OUTPUT" | grep "\\*\\* BUILD "`
if [ "$RESULT" != "** BUILD SUCCEEDED **" ]
then
echo "$OUTPUT"
exit 1
fi
echo "${RESULT}\n"
这篇关于从终端构建/运行iOS Xcode项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!