Could somebody go over how to exempt NSLog's from a release build of an app? Also, does it matter if comments are left in a release version? Thanks!
Use a macro like DLog
to wrap NSLog
, and turn it off in Release builds.
#ifdef DEBUG
# define DLog(...) NSLog(__VA_ARGS__)
#else
# define DLog(...) /* */
#endif
Comments absolutely don't matter. They are only in your source code, not the compiled output. You don't submit your source code to Apple, only the built copy of your app.
What I do to exclude NSLogs is to add this to the prefix file:
#define NSLog(...)
That way, when compiled, all NSLogs will be replaced with nothing, it will be like an empty line.
As for the comments, they never make it into the binary at all, those are ONLY for whoever can see the source code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With