How can I add an #ifdef DEBUG to Xcode? How can I add an #ifdef DEBUG to Xcode? xcode xcode

How can I add an #ifdef DEBUG to Xcode?


In recent Xcode project templates there’s already a DEBUG=1 macro defined for the Debug build configuration (in the Preprocessor Macros section). You can test it using the #if preprocessor directive.


I usually add my -DDEBUG=1 to the OTHER_C_FLAGS section in my XCode 4 project's build settings.

And yes, they can even discriminate between Debug / Release / ADHOC / Store builds.