I'm using CocoaPods on an app where the workspace, consists of a main application project, and some static libraries as sub-projects, each with their own dependencies. The static libraries are linked into the main project at compile time, and exist primarily as a means to encapsulate and organise code.
A problem arises where CocoaPods links the dependencies into the static libraries of the sub-projects. If two or more of these static libraries have the same dependencies, they cannot both be linked into the main project, as doing so results in duplicate symbols.
The workaround I have at the moment, is to create a "dummy" target in each of the sub-projects, and set that as the link target in the pod file. The real target uses the xcconfig file generated by CocoaPods, without any of the dependencies being linked in.
While this does indeed work, and id the simplest solution I could find, it still carries the extra unnecessary burden of having a dummy target in each project, e.g:
xcodeproj 'MyApp/MyApp.xcodeproj'
target :'MyApp' do
xcodeproj 'MyApp/MyApp.xcodeproj'
pod 'MBProgressHUD', '0.9'
link_with 'PodDummy'
end
Another disadvantage to this approach is that all the dependencies still need to be specified in the main project anyway, so that they are linked with the final executable.
So my question is: How can I use CocoaPods in a static library project, without linking the dependencies into the binary?
Or better yet: Could I specify the dependencies only in the static library sub-projects, and have CocoaPods figure out what needs to be linked in the main project, resolving duplicates in the process?
I'm thinking of only including the main project in the pod file, and having the sub-projects manually refer to the "Pods" directory for the headers.
There seems to be have been some discussion around the issue in the past, but I cannot see what, if anything, came of it. Related discussions are: