I\'d like to do the following in Xcode:
Find all NSLog commands without comments, and replace it with //NSLog...
In other words, I want to comment all NSLog
I have to do a separate answer because I cant comment yet, but one thing you really need to be careful about when you do a find and replace is something like this:
if(BOOL)
NSLog(@"blah blah");
[self doSomething];
If you comment out the nslog, the conditional gets associated with the method below it, correct me if I'm wrong
Update:
The answer bellow is actually much better. See here.
Initial answer:
There is a little hack that you could do. Search for all NSLog
and replace them with //NSLog
and than do another search for ////NSLog
and replace them with //NSLog
.
in the Menu bar : Edit > Find > Find and Replace in Workspace then, display options to use regular expressions. search/replace for "[^/]NSLog"
How to disable NSLog in Xcode for Production stage
Add #define NSLog
in appName-Prefix.pch
file in Supporting Files Folder of your project
and result file code look like...
// Prefix header for all source files of the 'NSLog' target in the 'NSLog' project
//
#import <Availability.h>
#ifndef __IPHONE_4_0
#warning "This project uses features only available in iOS SDK 4.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
//Add this to disable NSLog
#define NSLog //
#define NSLog if(1) NSLog
if you dont want log set 1 as 0.
#define NSLog(...)
add this line into your .pch file
if you want log than comment it