target配置
1.直接复制原有的target
,选择Duplicate Only
,然后改名
2.修改新target
对应的Scheme
3.修改新target
对应的info.plist
,先删除(移除引用),再导入(选择新的target
)
4.修改budleID
5.定义新target
的宏,Build Setting -> 输入 macros
-> 定义Debug
,Release
两个环境的宏
pod 配置
- 方式一
# 使用关键字abstract_target,使用多个target共享同一个pod,这里是common_pod
abstract_target 'common_pod' do
pod 'AFNetworking'
# targetA 单独拥有
target 'targetA' do
pod 'Masonry'
end
# targetB 单独拥有
target 'targetB' do
pod 'SDWebImage'
end
end
- 方式二
# 共同的pod
def commonPods
pod 'Masonry', '~> 1.1.0'
end
# targetA
target 'targetA' do
commonPods
pod 'AFNetworking', '~> 3.2.1'
end
# targetB
target 'targetB' do
commonPods
pod 'YYModel'
end
demo:
https://github.com/xjh093/MoreTargetConfig
参考
https://www.jianshu.com/p/18db54655246
https://www.cnblogs.com/niit-soft-518/p/11453449.html