iOS高效调试 写代码难免出现bug。储备些调试技能绝对能够提高你的工作效率,让bug无所遁形。下面就和大家分享一些我在工作中常用的iOS调试小技能。 1. 打印 最简单,基础的调试方法就是打印日志了。贴出封装好的日志打印代码: #ifdef DEBUG #define DLog(fmt, ...) ...
分类:
移动开发 时间:
2016-09-22 11:29:02
阅读次数:
241
原文链接 1.处理NSLog事件(开发者模式打印,发布者模式不打印) #ifdef DEBUG #define NSLog(FORMAT, ...) fprintf(stderr,"%s:%d\t%s\n",[[[NSString stringWithUTF8String:__FILE__] las ...
分类:
移动开发 时间:
2016-09-16 12:55:22
阅读次数:
238
1.处理NSLog事件(开发者模式打印,发布者模式不打印) 1 2 3 4 5 #ifdef DEBUG #define NSLog(FORMAT, ...) fprintf(stderr,"%s:%d\t%s\n",[[[NSString stringWithUTF8String:__FILE__ ...
分类:
移动开发 时间:
2016-09-09 10:14:23
阅读次数:
224
1、先看#ifdef的用法: 如果定义过 KEY1_PA0,就执行第一段代码,否则就执行第二段代码!! 2、#ifndef的用法: 在文件bsp_usart1.h中: 如果没有define过__USART1_H,就执行下面的语句;如果定义过,就不执行; 所以在一个.c文件里面,多次调用到该文件的时候 ...
分类:
其他好文 时间:
2016-09-07 12:42:25
阅读次数:
144
1.为了能找到dll的函数地址,生成dll时需要将其中的函数声明为C函数(extern "C"): #ifndef __MYDLL_H#define __MYDLL_H #ifdef MYDLL_EXPORTS#define MYDLL __declspec(dllexport)#else#defi ...
分类:
其他好文 时间:
2016-09-06 06:42:23
阅读次数:
150
Code:#ifdef __cplusplusextern "C" { #endif ... #ifdef __cplusplus} #endif 解释:1.c++中定义了__cplusplus,C语言中没有该定义。即:识别是c代码还是c++代码。 如下段代码: #include <stdio.h> ...
分类:
其他好文 时间:
2016-08-31 11:47:21
阅读次数:
153
全部在App中完成 1.在 App.h 头文件声明 #ifdef _DEBUGprotected: CMemoryState m_msOld, m_msNew, m_msDiff;#endif // _DEBUG 2.在 App::InitInstance() 中添加如下代码: #ifdef _DE ...
分类:
编程语言 时间:
2016-08-24 06:37:49
阅读次数:
372
创建pch 文件 STEP1: #ifdef DEBUG # define NSLog(...) NSLog(__VA_ARGS__) #else # define NSLog(...) #endif #define ALog(...) NSLog(__VA_ARGS__) STEP2: a. TA ...
分类:
其他好文 时间:
2016-08-21 22:51:54
阅读次数:
178
尽管这个概念已经让人说滥了 ,还是想简单记录一下, 以备以后查询。 #ifdef _DEBUG#define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)#else#define DEBUG_CLIENTBLOCK#endif#d ...
分类:
编程语言 时间:
2016-08-21 19:45:05
阅读次数:
176
基础类型 #ifdef WIN32 #define evutil_socket_t intptr_t #else #define evutil_socket_t int #endif ev_ssize_t 时间兼容函数 //前2个参数的计算结果放到第三个参数里面 #define evutil_tim ...
分类:
其他好文 时间:
2016-08-20 10:04:04
阅读次数:
282