方案一
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'MultiTarget' do
pod 'AFNetworking'
pod 'Masonry'
end
target 'MultiTarget copy' do
pod 'AFNetworking'
# pod 'Masonry'
end
方案二
- 通过abstract方式引入(推荐)
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
#虚拟target
abstract_target 'MultiTargetTest' do
pod 'AFNetworking'
pod 'Masonry'
target 'MultiTarget'
target 'MultiTarget copy'
end
根据target 添加不同依赖库
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
#虚拟target
abstract_target 'MultiTargetTest' do
pod 'AFNetworking'
target 'MultiTarget' do
pod 'Masonry'
end
target 'MultiTarget copy' do
end
end
方案三
- 循环target 添加pod
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
targetArray = ['MultiTarget','MultiTarget copy']
targetArray.each do |t|
target t do
pod 'Masonry'
end
end
网友评论