①多個target中使用相同的Pods依賴庫
比如瓦侮,名稱為CocoaPodsTest的target和Second的target都需要使用Reachability、SBJson莱褒、AFNetworking三個Pods依賴庫,可以使用link_with關(guān)鍵字來實(shí)現(xiàn)涎劈,將Podfile寫成如下方式:
link_with 'CocoaPodsTest', 'Second'
platform :ios
pod 'Reachability',? '~> 3.0.0'
pod 'SBJson', '~> 4.0.0'
platform :ios, '7.0'
pod 'AFNetworking', '~> 2.0'
這種寫法就實(shí)現(xiàn)了CocoaPodsTest和Second兩個target共用相同的Pods依賴庫广凸。
②不同的target使用完全不同的Pods依賴庫
CocoaPodsTest這個target使用的是Reachability阅茶、SBJson、AFNetworking三個依賴庫谅海,但Second這個target只需要使用OpenUDID這一個依賴庫脸哀,這時可以使用target關(guān)鍵字,Podfile的描述方式如下
target :'CocoaPodsTest' do
platform :ios
pod 'Reachability',? '~> 3.0.0'
pod 'SBJson', '~> 4.0.0'
platform :ios, '7.0'
pod 'AFNetworking', '~> 2.0'
end
target :'Second' do
pod 'OpenUDID', '~> 1.0.0'
end