Use the same Pods dependency library in multiple targets
For example, the target named CocoaPodsTest and the target named Second need to use the Pods dependency libraries Reachability, SBJson, and AFNetworking. You can use the link_with keyword. Write the Podfile as follows:
link_with 'CocoaPodsTest'.'Second'
platform :ios, '7.0'
pod 'Reachability'.'~ > 3.0.0'
pod 'SBJson'.'~ > 4.0.0'
pod 'AFNetworking'.'~ > 2.0'
Copy the code
This allows the CocoaPodsTest and Second targets to share the same Pods-dependent library.
Different targets use completely different Pods dependency libraries
CocoaPodsTest uses three dependent libraries Reachability, SBJson and AFNetworking for target. However, OpenUDID is the only dependent library for target Second. In this case, target keyword can be used. The Podfile is described as follows:
target :'CocoaPodsTest' do
platform :ios, '7.0'
pod 'Reachability'.'~ > 3.0.0'
pod 'SBJson'.'~ > 4.0.0'
pod 'AFNetworking'.'~ > 2.0'
end
target :'Second' do
pod 'OpenUDID'.'~ > 1.0.0'
end
Copy the code