Build/run iOS Xcode project from Terminal
I want to build a Xcode project from Terminal and then run it as required, also from Terminal.
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.
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.
Thanks
To build your xcode project from the command line using a bash script use:
/usr/bin/xcodebuild -target TargetYouWantToBuild -configuration Debug
Look at the man page for xcodebuild for more options.
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"
精彩评论