IOS 显示Debug信息
来源:互联网 发布:excel统计图显示数据 编辑:程序博客网 时间:2024/05/16 01:50
http://www.cnblogs.com/likwo/archive/2011/12/02/2272637.html
IOS 显示Debug信息
根据是Debug和Release显示不同的调试信息在Ios开发中是常见的
我以前是这么做的
#ifdef DEBUG
#define Dlog NSLog
#else
#define Dlog //NSLog
#endif
#else
#define Dlog //NSLog
#endif
但是在Xcode4.2 里当设置为release版本的时候,会给警告。
收集了下显示debug信息的方法
方法一
在prefix header pch文件中添加如下代码
#ifndef __OPTIMIZE__
# define NSLog(...) NSLog(__VA_ARGS__)
#else
# define NSLog(...) {}
# define NSLog(...) NSLog(__VA_ARGS__)
#else
# define NSLog(...) {}
#endif
方法二
// DLog is almost a drop-in replacement for NSLog
// DLog();
// DLog(@"here");
// DLog(@"value: %d", x);
// Unfortunately this doesn't work DLog(aStringVariable); you have to do this instead DLog(@"%@", aStringVariable);
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define DLog(...)
#endif
// ALog always displays output regardless of the DEBUG setting
#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
// DLog(@"here");
// DLog(@"value: %d", x);
// Unfortunately this doesn't work DLog(aStringVariable); you have to do this instead DLog(@"%@", aStringVariable);
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define DLog(...)
#endif
// ALog always displays output regardless of the DEBUG setting
#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
当然,你还想需要更强大的调试能力,那么这个开源的NSLogger可能会比较对你的口味。 https://github.com/fpillet/NSLogger
- IOS 显示Debug信息
- IOS 显示Debug信息
- VS 显示 debug 信息
- win2003r2 的pv debug信息显示问题
- android 让真机显示 DeBug Log调试信息
- Unity3D-在移动端显示Debug信息
- MyEclipse Debug模式下无法显示debug信息
- ios Debug Release,的NSlog显示问题
- 使用 RzRichEdit 显示多色彩的Debug信息函数。
- C++程序 使用命令行窗口显示Debug信息
- [Hadoop] Hadoop Yarn显示DEBUG调试信息的配置方法
- Unity安卓移动设备显示Debug.Log信息
- Unity3d 安卓调试 手机屏幕显示Debug信息
- Unity安卓移动设备显示Debug.Log信息
- iOS开发Debug之获取UITextField当前显示的内容
- iOS 整合Settings.bundle显示版本信息
- iOS锁屏显示歌曲信息
- iOS debug
- ActiveReports 7.0报表控件版本比较
- 移除html格式:RemoveHTML()方法
- 自定义Dialog 简述
- 大小端模式
- 蛇形矩阵
- IOS 显示Debug信息
- 忆枫提供真实的伤感日志_错过,就真的不再有了
- 十大推荐提交的安卓市场
- 70.将A工程下某一个文件下除.svn外的所有文件复制备份到B工程的同一目录下
- thinkphp tp 中做编辑模版的功能
- 解决输入框和图片按钮控件不能对齐
- Qt的移植
- django 设置cookie,httponly
- UML类图关系表示方法