Fengson
Fengson

Reputation: 4912

Xcode - how to add a flag which can be checked in a header file?

I have a header file with many constants set for my project.
I would like to run a certain part of my code depending on the target I've chosen. I know how one way to do this is by using NSBundle's infoDictionary method. However, I would like to use only .h file here for all my constants.

Currently I am using DEBUG flag and running my code by checking this flag as such:

#if DEBUG
...
#else
...
#endif

I would like to be able to add my own flag(s) in my targets and check for those in header file, rather than rely on DEBUG flag.

Upvotes: 1

Views: 670

Answers (1)

Krzysztof
Krzysztof

Reputation: 1471

Add the flags to the Preprocessor Macros in build settings for the target.

enter image description here

Upvotes: 7

Related Questions