Removing NSLogs for distribution
来源:互联网 发布:七妹电音软件 编辑:程序博客网 时间:2024/06/18 07:44
When developing an iOS or Mac app, NSLogs are very handy during development. These are quite useless for an app on an end users phone or computer, so removing every log is often a good idea, especially if you like to log a lot of information. This might sound like a pain, commenting out everyNSLog whenever you build for the AppStore? But no, there’s a much simpler solution, coming from our friend the preprocessor macro.
Every iOS and Mac project has a special file called <your project>-Prefix.pch. What does this mean? This is a precompiled header – a .h that is imported by every file in your project without the need to manually #import it. Combining this and preprocessor macros gives a very elegant solution to removing logs when building for the AppStore, and keeping them when developing.
Just put this into your pch:
#if DEBUG#warning NSLogs will be shown#else#define NSLog(...) {}#endif
Now try and build for development, you will get a warning telling you that logs will be shown. Build again for release and the macro replaces every NSLog (at compile time) with nothing.
原文链接:http://b2cloud.com.au/how-to-guides/removing-nslogs-for-distribution/
- Removing NSLogs for distribution
- removing
- Building Your App for Distribution
- missing ios distribution signing for
- Setting or removing an image for an CListCtrl item
- Distribution
- Cloudera’s Distribution for Apache Hadoop
- Wireless Ad Hoc Distribution for iPhone Apps
- Study notes for Discrete Probability Distribution
- Tutorials for Chi-square Distribution 1
- Tutorials for Chi-square Distribution 2
- Missing iOS Distribution signing identity for
- Missing iOS Distribution signing identity for
- Missing iOS Distribution signing identity for...
- Missing iOS Distribution signing identity for XXXXXX
- Missing iOS Distribution signing identity for *****问题解决
- Missing iOS Distribution signing identity for ...
- Configuring Your Xcode Project for Distribution
- HTML5 本地数据库
- char[] 转换成String
- Linux进程状态(ps stat)之R、S、D、T、Z、X
- 利用openssl管理证书及SSL编程第1部分: openssl证书管理
- Java——协变数组和类型擦除以及泛型相关知识
- Removing NSLogs for distribution
- Jenkins的新建job和配置job
- 网管开发-servlet获值问题 20151216
- CentOS6.5下编译安装mysql-5.6.27
- leetcode Add Two Numbers
- 有趣的keil MDK细节
- hdoj 1995 汉诺塔V 【找规律 水题】
- Android倒计时器——CountDownTimer
- 已阻止跨源请求:同源策略禁止读取位于...的远程资源。(原因:CORS 头缺少 'Access-Control-Allow-Origin')。