iOS宏编译的两种方法

来源:互联网 发布:js 上传与下载文件 编辑:程序博客网 时间:2024/05/19 11:44
iOS宏编译的两种方法


第一种 适合修改原基础上得调试代码

#ifdef DEBUG

#define NSLog(...) NSLog(__VA_ARGS__)
#define debugMethod() NSLog(@"%s", __func__)
#else
#define NSLog(…)
#define debugMethod()
#endif
----------------------------------------------------------------------------

第二种 适合开发起步阶段

#define WXDEBUG 1


#if WXDEBUG
#define WXLog(xx, ...) NSLog(@"%s(%d): " xx, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define WXLog(xx, …) ((void)0)
#endif // #ifdef DEBUG




//使用: WXLog(@"test");
0 0
原创粉丝点击