How to disable NSLog all over the app?

Timur Bernikovich picture Timur Bernikovich · Apr 14, 2013 · Viewed 13.7k times · Source

I want to disable NSLog() across all instances in an app. I found some code that does that:

#ifndef DEBUG
#define NSLog //
#endif

But adding this code to each file isn't good idea. How can I make it easier?

Answer

jszumski picture jszumski · Apr 14, 2013

Xcode has a precompiled header file ({project-name}-Prefix.pch in the Supporting Files group by default) that is a great place to put code that will be used across every file in the project. For going a step further and improving the log message itself, see Is it true that one should not use NSLog() on production code?.