普段からObjective-Cを書いている時は、NSLogでデバッグ出力していました。
しかし、NSLogを使うと、Organizerのコンソールでwarningが発生します。
AngryBirdでも以下のような感じで出ます。
AngryBirds[15177] <Warning>: --> activateCrystalSetting: [set 2][val YES]
AngryBirds[15177] <Warning>: --> activateCrystalSetting: [set 2][val NO]
AngryBirds[15177] <Warning>: --> activateCrystalSetting: [set 2][val YES]
AngryBirds[15177] <Warning>: --> activateCrystalSetting: [set 2][val NO]
そこで、ash_logを使いましょう。
#import <asl.h>
asl_log(NULL, NULL, ASL_LEVEL_DEBUG, "%s", [message UTF8String]);
こんな感じで出力できます。
リリースビルドの場合、ASL_LEVEL_NOTICE以上のレベルしか出力されません。
ただ、残念ながらXcodeのコーディングしている時の下のウィンドウには出力されません。
- 基本的にコーディング時は、NSLogを使う
- リリース時には、NSLogは全部消す。
- リリースした後も見せたい情報のみ、asl_logで出力。
というのが、いいのではないでしょうか?
参考
http://doing-it-wrong.mikeweller.com/2012/07/youre-doing-it-wrong-1-nslogdebug-ios.html