开发者

Preprocessor in Xcode

I want to set the DEBUG value to 1 or 0 from code. After specific event answer and not from other C Flags?

#if DEBUG==1
#define DBLog(format, ...) NSLog(@"%s:%@", __PRETTY_开发者_运维技巧FUNCTION__,[NSString stringWithFormat:format, ## __VA_ARGS__]);
#define MARK    DBLog(@"%s", __PRETTY_FUNCTION__);

#else
#define DBLog(format, ...)
#define MARK

#endif 


The preprocessor directives are used in a phase before compiling your code, so you can't choose one of those branches during execution. You have to use a static variable or something like that.

if (mystaticvariable) { DBLog...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜