-
選中
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
否則會報錯
補充
在
Swift
項目中還需要設(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