开发者

Disabling NSLogs from .a libs

开发者 https://www.devze.com 2023-03-12 11:33 出处:网络
I\'ve a lot of .a in my project from various libraries and some of the spam the console with output. Is there a way to dis开发者_如何学JAVAable all NSLogs from my build even my own?

I've a lot of .a in my project from various libraries and some of the spam the console with output.

Is there a way to dis开发者_如何学JAVAable all NSLogs from my build even my own?

Will these effect the final release build in anyway?

For example:

AD URL: http://ads.mp.mydas.mobi/getAd.php5?medialets=false&sdkapid=44300&auid=a83014b158258e5bda3ee3f3634eaa17b66d9fce&mmisdk=4.2.4-11.4.25.i&ua=iPhone%204.2.1&dv=4.2.1&dm=iPhone2,1&adtype=MMBannerAdTop&hswd=320&hsht=53&accelerometer=true&vendor=adwhirl&video=true&language=en&country=IE&cachedvideo=true

This gets output to the console. But searching in the project for text 'AD URL' finds nothing. Can I force these to be removed ignored somehow?


NSLog does indeed effect the performance of release builds. I recommend doing a global search and replace of all NSLog statements. That way, you can delete or at least comment out all logging statements.

For future reference, you can make your own loggig function that wraps NSLog, but checks for a compile time constant, which you would define.

EDIT:

It might be possible to override those NSLogs with a category. (I have no clue which class to make a category of, however.)


simple (but not the cleanest of approaches) approach is to declare some #define like

#if defined(NO_LOGS)
    #define NSLog(xyz) 
#endif

which will supress all NSLog statements when you turn on NO_LOGS.

0

精彩评论

暂无评论...
验证码 换一张
取 消