DEBUG模式和RELEASE模式切换

应用程序本身的状态模式:debug调试模式(强调方便)/release发布模式(强调性能)

符号DEBUG/_DEBUG表示Xcode工具的状态内容值(Xcode工具状态呈现值/符号DEBUG/_DEBUG存在表示当前处于debug调试模式符号不存在表示当前处于发布模式)

#if defined(DEBUG)||defined(_DEBUG)

BCMPhoneBindViewController *scanVC = [[BCMPhoneBindViewController alloc] init];
[self/*.tabBarController*/.navigationController pushViewController:scanVC animated:NO];

#else

ScanViewController *scanVC = [[ScanViewController alloc] init];
[self/*.tabBarController*/.navigationController pushViewController:scanVC animated:NO];

#endif

选择Product->Scheme->Edit Scheme
在这里插入图片描述
DEBUG模式和RELEASE模式切换
在这里插入图片描述
选择Release则默认没有定义Debug则代码中#if…#else间指令码不会执行,在发布程序时节省一些硬件设备资源。
选择Debug则默认定义Debug则代码中#if…#else间指令码执行,方便开发过程中调试

发布了121 篇原创文章 · 获赞 4 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/yanhaijunyan/article/details/105495962