How to clear NSLog output from code?

被刻印的时光 ゝ 提交于 2019-12-22 14:27:10

问题



is there a way to clear console output from code?

thanks.


回答1:


SHORTCUT I PREFER :

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




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/4780376/how-to-clear-nslog-output-from-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!