[iOS] ReleaseビルドでNSLogを出力させない設定方法

iOS アプリで、ReleaseビルドでNSLogを出力させない設定方法

アプリ名-Prefix.pch ファイルに下記を定義すればOKです。

#ifdef DEBUG
#   define NSLog(...) NSLog(__VA_ARGS__)
#else 
#   define NSLog(...)
#endif

ちなみに、DEBUG のON/OFFの切り替えは下記の画像のように「PROJECT > Build Settings > Apple LLVM compiler 4.2 – Preproessing」で設定します。

ios-debug-off

以上です。

[参考]

objective c – Enable and Disable NSLog in DEBUG mode – Stack Overflow