开发者

How to clear NSLog output from code?

is there a wa开发者_运维知识库y to clear console output from code?

thanks.


SHORTCUT I PREFER :

Simply USE +K Keyboard Shortcut when you want to clear the NSLOG Data.


I don't think it's possible to do that in code.

Though there is an option in XCode preferences (Debugging tab) called Auto Clear Debug Console. It will clear console output each time you run the application. That might fit your needs.


If you search the site, you will find several ways of manipulating NSLog. I use

#ifndef __OPTIMIZE__
#    define NSLog(...) NSLog(__VA_ARGS__)
#else
#    define NSLog(...) {}
#endif

to kill the output. Put the above in your .pch file in your 'Other Sources' folder and it works out of the box for release builds. Replace OPTIMIZE with some other preprocessing flag if you want this to work for other build configurations.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜