开发者

Is there a special compiler variable in iOS SDK, which identifies the configuration at compile time?

As subject says. I would like to identify the configuration (Debug, Release, whatever), which is currently set in XCode during compilation

Sort of:

#if Co开发者_运维知识库nfiguration
#endif

Does one know?


I use

#ifdef DEBUG
 <whatever>
#endif

for wrapping logging/debugging lines. I came across this on Cocoa Is My Girlfriend's Dropping NSLog in release builds article. I haven't done it for other configurations, but I suspect that adding -DDEBUG to 'Other C Flags' may define DEBUG. If that's the case, then you should be able to do something similar for RELEASE or DISTRIBUTION.


Another handy one is:

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 40000

Which is the same as saying "if I am building with SDK for iOS 4.0 or greater"...


Your snippet will work if you add $(CONFIGURATION) to the Preprocessor Macros in the projects build settings.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜