1. 新增Configurations
配置
- 点击工程文件 -->
Info
-->PROJECT
-->Configuration
- 点击“+”,新增一条配置,如
Test
新增配置 - 配置
Build Settings
-
Apple Clang - Preprocessing
-->Preprocessor Macros
修改DEBUG=1
为TEST=1
-
Swift Compliler Conditions
-->Active Compilation Conditions
修改DEBUG
为TEST
-
2. 配置Pod
- 配置
Podfile
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| if config.name == 'Test' config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)','TEST=1'] config.build_settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS'] = ['$(inherited)','TEST'] end end end end
- 执行命令
pod install
3. 多环境的应用和使用配置
- 新增
Scheme
在Xcode
调试区,点击Target
,选择新建方案
新建Scheme
TEST Scheme - 配置
TEST Scheme
在Xcode
调试区,点击Target
,选择编辑方案
运行方案配置
网友评论