How can I add an #ifdef DEBUG to Xcode?
zoul answered:
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.
Also check out zoul's comment, he gives you all the info you need:
Ah yes, thanks, the whole build thing is getting… complicated :) I’ve edited the post. @nevan, take a look at Build Settings and filter for “preprocessor”. You should see a section called Preprocessor Macros, that’s where you should put a
DEBUG=1
line next to the Debug sch—— configuration.
Basically
#ifdef DEBUG
//put code here
#endif
if you want to avoid certain code running on the released version of your app
No comments:
Post a Comment