How to disable NSLog all over the app?

c-preprocessor, ios, nslog, objective-c, xcode

Solution

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

Problem

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?

Original source

Related problems