neil
neil

Reputation: 111

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 Configuration
#endif

Does one know?

Upvotes: 4

Views: 268

Answers (3)

Matthias Bauch
Matthias Bauch

Reputation: 90117

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

Upvotes: 0

Brad
Brad

Reputation: 11515

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"...

Upvotes: 0

westsider
westsider

Reputation: 4985

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.

Upvotes: 2

Related Questions