How can I add an #ifdef DEBUG to Xcode?

后端 未结 2 1432
长情又很酷
长情又很酷 2021-02-04 01:46

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
             


        
相关标签:
2条回答
  • 2021-02-04 02:01

    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.

    0 讨论(0)
  • 2021-02-04 02:02

    I usually add my -DDEBUG=1 to the OTHER_C_FLAGS section in my XCode 4 project's build settings.

    And yes, they can even discriminate between Debug / Release / ADHOC / Store builds.

    0 讨论(0)
提交回复
热议问题