user204088
user204088

Reputation: 1951

Xcode build parameters

I am looking at compiling building a simple app I have wrote using Objective C. Currently all the application does it print 'hello [dev|production]' on screen.

What I would like to do is able to add a build parameter into xcode so that if I build it with a dev flag then the output would be 'hello dev' else the output would be 'hello production'.

Can someone give me an code example or link to a resource which will allow me to do this.

The idea is not to distingusish between DEBUG and PRODUCTION but rather to be able to add values into the build process which will change the compiled application output.

Upvotes: 4

Views: 4184

Answers (1)

Rui Peres
Rui Peres

Reputation: 25917

You can add another value to your preprocessor Macros, here:

enter image description here

If you want to add a another build configuration: enter image description here

Edit 1:

The idea is not to distingusish between DEBUG and PRODUCTION but rather to be able to add values into the build process which will change the compiled application output.

Something you can do is to have two plist files, with all the values you want to use in your application. If you are in debug mode use debug.plist file, otherwise release.plist. This allows you to better control what are you using in your application for each build.

You can find the configurations here:

enter image description here

(I used PlotCreator as an example... It's an open source lib)

Upvotes: 3

Related Questions