How to determine whether code is running in DEBUG / RELEASE build?

Check your project’s build settings under ‘Apple LLVM – Preprocessing’, ‘Preprocessor Macros’ for debug to ensure that DEBUG is being set – do this by selecting the project and clicking on the build settings tab. Search for DEBUG and look to see if indeed DEBUG is being set.

Pay attention though. You may see DEBUG changed to another variable name such as DEBUG_MODE.

Build Settings tab of my project settings

then conditionally code for DEBUG in your source files

#ifdef DEBUG

// Something to log your sensitive data here

#else

// 

#endif

Leave a Comment