1> #ifdef DEBUG代码块 #ifdef DEBUG NSLog(@"Debug 模式的代码..."); #else NSLog(@"Release 模式的代码..."); #endif 2> xcode 切换 debug 和 release版本 如果要测试在不同模式下代码的运行效果,可以选择 Product -> Scheme -> Edit Scheme 修改 Build Configuration 即可