I am debugging the application in iPhone Simulator.I want to show log only when the application is running in debug mode in iPhone Simulator.I am using the NSLog. How can I put the condition for NSLog so that the logs should be printed on console in debug mode only?
I am debugging the application in iPhone Simulator.I want to show log only when
Share
Put this in your
.pchfile:Now you can use
DLoginstead ofNSLogfor all log messages that should only be printed in your debug builds.One could also redefine
NSLogbut there sometimes are log messages that you do want to appear in the device logs (like critical error messages).See also The Evolution of a Replacement for NSLog for ideas on how to improve the debug log macro.