본문 바로가기

iPhone

ios 배포버전 로그(NSLog) 숨기기



App 배포시 NSLog를 숨기지 않으면 Orgaizer의 Console에서 해당 로그가 찍혀 나오는것을 볼 수 있습니다. 이를 막기 위해서는 .pch파일 (프로젝트명.pch)에 아래의 코드를 추가 한 후 Build Setting에서 Preprocessor Macros의 Debug에 DEBUG=1을 추가해 주시면 됩니다.


#ifdef DEBUG

#define NSLog( s, ... ) NSLog(@"%s(%d)\n%@", __FUNCTION__, __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__])

#else

#define NSLog( s, ... )

#endif

#define LOG(s, ...) NSLog(@s, ##__VA_ARGS__)