Is there anyway to delete the NSLog lines from the app by any trick/tool? I usually use NSLog's in each & every method to understand the flow of control & to know about the values of the app's variables. I also use lots of commend lines to explain the nature of methods and variables.
But, in some stage, these NSLog's & comment lines confusing the program understanding (It's to me). So I need to again & again deleting/creating this logs & comments. Is there a way to show/hide them by any trick in Xcode?
Thanks in advance
Best Answer
as a Dev, I can offer these two methods, although I agree with Daniel, that Stack Overflow is a better place to ask this.
Anyway, the first is a simple replace.
Shift-Option-f. Then type NSLog. That will find all the occurances of NSLog in your app.
Then switch find to replace. Then replace "NSLog" with "//NSLog". That will comment out all of them.
A second - better option takes a bit more work.
First, do the above but instead of replacing the string with "//NSLog", replace it with something like "DLog".
Then, in the prefix.pch file.. Write something like this:
This way, while your app is in debug mode, all the logs will appear, but when you move your app to release mode, the logs are hidden.
Hope this helps.