-
選中
PROJECT->info->Configurations添加環(huán)境配置
image1.png
image2.png -
PROJECT中Build Setting選擇Preprocessor macros修改:pre_debug=1
image3.png 新建
new scheme選中tag和取名-
在
edit Scheme中選擇剛創(chuàng)建的環(huán)境pre_debug
image4.png
如果有使用
cocoapods的話,需要執(zhí)行pod install否則會(huì)報(bào)錯(cuò)
補(bǔ)充
在
Swift項(xiàng)目中還需要設(shè)置Swift Complier - Custom Flags->Active Compilation Condition

image.png
#if DEBUG // 開發(fā)環(huán)境
NSLog(@"------DEBUG-------");
//dosomething...
#elif pre_debug // 本地開發(fā)環(huán)境
NSLog(@"------pre_debug-------");
#else
NSLog(@"------release-------");
#endif



