问题
I have found a set of great macros here Objective C Macros
I put the:
#if DEBUG==1
#define .... macros
in my header file.
Now I simply can't figure out where to set DEBUG=1 or DEBUG=0 in Xcode so that it will define the macro when debugging and not when releasing.
Hope someone can help me find the missing drop down menu:)
回答1:
EDIT:
Ok apparently, when working on an iPhone application, you have to:
- select iPhone device as the active sdk
- then edit project or target settings and in "Other C Flags" you type "-DDEBUG=1"
Edit your project or target settings, select your Debug
configuration then look for the "Preprocessor Macros" settings and type DEBUG=1
However, I would rather define NDEBUG
in the Release
configuration then write
#ifndef NDEBUG // if we are in debug mode
#define bla bla bla
#endif
Note: you need to have a target that compiles Objective-C source files to a library or application properly set up; otherwise the settings don't appear in the UI.
来源:https://stackoverflow.com/questions/2017108/how-to-setup-xcodes-debug-release-target-settings