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

As the subject says. I would like to define the configuration (Debug, Release, whatever) that is currently installed in Xcode at compile time

Sorting:

#if Configuration #endif 

Did you know?

+4
source share
3 answers

I use

 #ifdef DEBUG <whatever> #endif 

for wrapping log lines / debugging. I came across this on Cocoa Is My Girlfriend Dropping NSLog in the release version . I did not do this for other configurations, but I suspect that adding -DDEBUG to "Other C Flags" might define DEBUG. If so, then you should do something similar for RELEASE or DISTRIBUTION.

+2
source

Another convenient is:

 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 40000 

This is the same as saying "if I create an SDK for iOS 4.0 or higher" ...

0
source

Your snippet will work if you add $(CONFIGURATION) to the preprocessor macros in the project build settings.

0
source

All Articles