What is the purpose of each target in a Cocoapods workspace?
When I created a new CocoaPods library via "pod lib create Foo", I expected only two targets: One to build my library, and one to build my example.
But the resulting xcworkspace has a total of four targets:
What's the meaning of these targets?
(I chose no demo application, view-based testing, or testing frameworks.)
There are 2 project in your workspace one is yours and the other is cocoapods, and cocoapods adds new target for each pod which you add in your Podfile. For example, let's say this is your Podfile :
platform :ios, '7.0'
pod 'AFNetworking', '~> 2.5.4'
pod 'BPXLUUIDHandler'
you should see in your pod project's target list something like this :
but what is that mean?
Targets where cocoapods manage everything for each pod. For example if you choose AFNwtworking target in pod project, you must see something like this :
but for example how cocoapods know to add "Link binary with libraries" frameworks like above? Well, please check AFNetworking's podspec file for this :
s.public_header_files = 'AFNetworking/*.h'
s.source_files = 'AFNetworking/AFNetworking.h'
s.subspec 'Serialization' do |ss|
ss.source_files = 'AFNetworking/AFURL{Request,Response}Serialization.{h,m}'
ss.ios.frameworks = 'MobileCoreServices', 'CoreGraphics'
ss.osx.frameworks = 'CoreServices'
end
s.subspec 'Security' do |ss|
ss.source_files = 'AFNetworking/AFSecurityPolicy.{h,m}'
ss.frameworks = 'Security'
end
s.subspec 'Reachability' do |ss|
ss.source_files = 'AFNetworking/AFNetworkReachabilityManager.{h,m}'
ss.frameworks = 'SystemConfiguration'
end
as you can see above this lines "ss.ios.frameworks" are describe what is going on there.
Hope everything is clear now.