1.單個target依賴庫
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'targetName1' do
pod 'MJRefresh', '~> 1.4.6'
pod 'Masonry', '~> 0.6.1'
end
2.多個target依賴庫
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'targetName1' do
pod 'MJRefresh', '~> 1.4.6'
pod 'Masonry', '~> 0.6.1'
endtarget '
target 'Name2' do
pod 'MJRefresh', '~> 1.4.6'
pod 'Masonry', '~> 0.6.1'
pod 'AFNetworking', '~> 3.0'
end
3.多個target依賴庫高端寫法
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
# ruby語法: 如果有新的target直接加入該數(shù)組
targetsArray = ['targetName1', 'targetName2', 'targetName3', 'targetName4', 'targetName5']
# 循環(huán)
targetsArray.each do |t|
target t do
pod 'MJRefresh', '~> 1.4.6'
pod 'Masonry', '~> 0.6.1'
end
end
注意:
(1) platform : 和 ios之間不能有空格鱼的,否則報pod語法錯誤
(2)podfile中的注釋使用#號纱新,不能使用//卧须,否則報錯
(3)Podfile錯誤寫法展示: