Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add an #ifdef DEBUG to Xcode?

Tags:

I have some code in a project which should never be used in the release build, but is useful when testing. I'd like to do something like this:

#ifdef DEBUG     // Run my debugging only code #endif 

Where do I add the DEBUG setting in Xcode 4? I tried putting it in the "Edit Scheme" under Run MyApp->Arguments Passed On Launch, but it didn't work. Alternatively, is there a flag already available for this?

like image 968
nevan king Avatar asked Nov 24 '11 12:11

nevan king


People also ask

How can I add another account to my Gmail?

Sign in to your Google Admin console. Sign in using your administrator account (does not end in @gmail.com). Users. At the top of the page, click Invite new user/Add new user.

Can I have 2 Gmail accounts on my phone?

Yes, you can easily step up and manage multiple Gmail accounts in your Android and iOS smartphone it's true.


1 Answers

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.

like image 184
zoul Avatar answered Oct 24 '22 02:10

zoul