1. 程式人生 > >iOS開發技巧之:Xcode8 NSLog列印json不全解決辦法

iOS開發技巧之:Xcode8 NSLog列印json不全解決辦法

據說國外的大神是這麼解決的:

 

#ifdef DEBUG

#define SLog(format, ...) printf("class: <%p %s:(%d) > method: %s \n%s\n", self, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, __PRETTY_FUNCTION__, [[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String] )

#else

#define SLog(format, ...)

#endif

 

 

在此基礎上進行了修改:

 

#ifdef DEBUG //開發階段

#define NSLog(format,...) printf("%s",[[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String])

 

#else //釋出階段

#define NSLog(...)

 

問題解決了,OK~