Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building/running iOS app from command line

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.

like image 327
clint Avatar asked Apr 30 '26 05:04

clint


1 Answers

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.

like image 55
lxt Avatar answered May 01 '26 17:05

lxt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!