3

I am trying to build/run my iOS app from command line. To build the app, the command which I give in shell script is as follows:

PROJECT_DIR="/Users/ingenyous/Desktop/splistV11_test_sh_build/code/app/ios"
TARGET_NAME="splistapp2"
TARGET_SDK="iphoneos5.1"
PROJECT_BUILD_DIR="${PROJECT_DIR}/build/Release-iphoneos"
OUTPUT_DIR="/Users/ingenyous/Desktop/ipa"

# compile project
echo Building Project
cd "${PROJECT_DIR}"
xcodebuild -target "${TARGET_NAME}" -sdk "${TARGET_SDK}" -configuration Release

Here I specify the target name and other parameters. Is it possible to give the target properties like product name and other options in this script itself, which can overwrite the properties given actually in the editor target. or be able to create the target itself from shell script and not needing to create targets from Xcode editor.

1 Answer 1

6

You can certainly set the product name using xcodebuild:

xcodebuild -target "${TARGET_NAME}" -configuration Release build PRODUCT_NAME=MyProduct

There can be issues with multiple targets, see this existing SO question

You can set any build setting in this way. A full list of build settings is available on Apple's developer site, and you can also check out the man for xcodebuild.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks lxt for this. Can you tell me if I can give app icons also in xcodebuild.? Basically, externally including some folder which will contain the icon images which will overwrite the icons given in the target.
That seems a little more complicated. I don't believe you can within xcodebuild, but I suppose you could conceivably write a shell script that swapped the icons, and call that before calling xcodebuild.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.