1

I'm getting an error, but only when profiling my app using the simulator:

Use of undeclared identifier 'DEBUG'

Any ideas as to how to fix this? The only time this occurs is specifically when profiling my app with the simulator.

2 Answers 2

6

You're probably running the profile in RELEASE mode. DEBUG can be defined at compile time with some build settings. Check within Xcode your current scheme settings. In your profile scheme, if your Build Configuration is set to anything other than DEBUG, this is likely the culprit. If you'd like to check for the existence of DEBUG try something like this:

#ifdef DEBUG
      // do some things
#endif
1
  • Thanks! Stupid mistake on my part, was checking for the existence of DEBUG incorrectly.
    – nmock
    Feb 25, 2015 at 2:10
1

It also happened to me when I Run App in Release. I resolve it by this step:
1. Select your target;
2. Select Build Settings;
3. Search "Preprocessor Macros";
4. Check if [DEBUG=0] is in Release line or not;
5. If not, add [DEBUG=0] and then Run again.

1
  • This solved it perfectly for me! We were using 2 ways of checking if it was debug vs release mode: #ifdef DEBUG and return DEBUG ? CLIENT_ID_DEBUG : CLIENT_ID_RELEASE; Rather than change the code everywhere, making sure DEBUG=0 was set for release did the trick.
    – Claude
    May 24, 2020 at 4:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.