I'm working on an iOS project in xcode and I'd like to include different codes depending on the build scheme. ie: For anything except the开发者_高级运维 Distribution on an iOS Device scheme, I'd like to include a bunch of debug stuff. But for the Distribution on an iOS Device scheme, I don't want to include the debug stuff.
If I can add some sort of conditional code block it will be very helpful as it will eliminate the chance of me forgetting to change the flag manually.
Thanks!
By default when you create a new XCode 4 project it will add DEBUG
to your GCC_PREPROCESSOR_DEFINITIONS
(Preprocessor Macros) under build settings so you can do the following.
#ifdef DEBUG
//Debug only code here
#endif
If you need more preprocessor definitions add them under GCC_PREPROCESSOR_DEFINITIONS
or OTHER_CFLAGS
or OTHER_CPLUSPLUSFLAGS
[prefix the last 2 with -D
] for the correct build configuration.
精彩评论