Friday, March 30, 2012

iOS : How to disable all NSLog for release

1. Rename your all NSLog to MyLog

2. Add this code to your <ProjectName>-Prefix.pch file

#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>


#ifdef DEBUG  
#define MyLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);

#else  
#define MyLog(...)

No comments:

Post a Comment