Console only on Debug mode & not in release mode

It is strongly recommended to console each thing during the development time of the application. But during the development time, developers also have to send the build to the end client. Its an obvious thing that, no one would wish to produce number of console messages using the build sent to the client.

XCode supports two kind of build process.

  • Debug – Debug mode, for development & testing of the application within development area.
  • Release – Release mode, for sending build either to client or to apple store.

So, Once you starting the development & during the application development, you might have written number of NSLog. So, while sending build to client or apple-store, developer might go for commenting all the NSLogs. Same way, Developer will again un-comment all NSLogs to continue the development. I strongly believe this is not a recommended way to solve this issue & I have figure out the way to fix it.

This post will help you to enable console logging during development time only.

Open your project & go to yourProject.pch file ( as illustrated in image below )

Console during development mode

Console during development mode

Now, put following lines of code.

Where-ever you wish to console, use STLog instead of NSLog. By using STLog, it will console for Debug mode only.

Leave a Reply

Your email address will not be published. Required fields are marked *



*