How to clear NSLog 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.
精彩评论