Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mikezang

macrumors 6502a
Original poster
My app has some code to initialize data, and I want to those code only useful in debug mode, I mean they won't compile in release mode.

Is there any keyword (like __DEBUG__) so that I can use it to condition compile my app.

I searched Internet but no result.
 
Google:
Code:
xcode debug flag

Or, under 'Target' Info, 'Build' tab, "Preprocessor Macros" add:
Code:
DEBUG=1
Xcode know where I am at, debug mode or release mode, so I think there should be a global flag we can use and needn't write code like DEBUG = 1, this flag should maintenance by xcode, not developer. so I just write code as below, I don't need take care if I am at debug mode, is it possbile?

Code:
#if _DEBUG_ 
 // do something
#endif
 
Xcode know where I am at, debug mode or release mode, so I think there should be a global flag we can use...

If you think XCode should support this, then please go ahead and request it from Apple 🙂

If you want to know how to do this, read my last post 😀
 
I got that info from Internet before I post thread, maybe my question is not so clear.

Anyway, thanks for your message.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.