I want to test the below lines of code :
#ifdef DEBUG
#define VAR 10
#else
#define VAR 20
#endif
In project->build settings->preprocessor macros
I had DEBUG=1
and NSLogging
the value of VAR
logged 10
.
Then I set DEBUG=0
to check if it loggs 20
. But it logged 10
only.
How to set DEBUG value so that else
condition in code is satisfied?
As Aditya said, other library used in application may have defined DEBUG
macro and hence even I remove it from preprocessor macro
the condition #ifdef DEBUG
is always satisfied.
The solution is simple though. Just use different macro name such as IS_DEBUG
instead of DEBUG
. This solved my problem. It was a matter of just a macro name.