PDA

View Full Version : Build Configuration




davbeck
Oct 17, 2009, 05:11 PM
Is there any way to get access to the active build configuration in my code? I would like to add in some debugging statements if the configuration is debug like so:

#ifdef DEBUG
//log something
#endif



lee1210
Oct 17, 2009, 05:27 PM
In XCode, go to your project settings. Under the build tab, look for Preprocessor Macros. Set a variable (no need for an =x if you just want to use #ifdef) there for your debug build configuration, and do not define it for your release setting. Then you can use #ifdef and put in the name of the variable you defined to put in your debugging statements.

-Lee

davbeck
Oct 17, 2009, 05:40 PM
Thanks thats a brilliant solution.