Cocopod in subproject

I have a project with a subproject. Both the subproject and the main project should use Cocoapods to integrate the library, which, apparently, cannot be integrated without Cocoapods. Therefore, I have Cocoapods created for both the main project and its subproject. The subproject is built in the generated workspace, but when compiling the main project, the following error occurs: ld: library not found for -lPods-Subproject name-Library.

The only idea I have now is that I have to somehow return the Cocoapods repo subproject to use the main project name, so when the subproject assembly is checked against the same libraries as the main Cocoapods project generates (presumably -lPods -Main Project Name-Library), which will be created as part of the main project building process.

How can i achieve this? Is there a better way to get the result I want?

+4
source share
1 answer

Try writing your file under this way:

workspace 'FinalWorkspace.xcworkspace'
xcodeproj 'MainWorkspace/MainWorkspace.xcodeproj'
xcodeproj 'SubWorkspace/SubWorkspace.xcodeproj'

target 'MainWorkspace' do
  platform :ios, '8.0'
  xcodeproj 'MainWorkspace/MainWorkspace.xcodeproj'
  pod 'nameofpod1', '~> 1.1'
  pod 'nameofpod2', '~> 2.2'
  pod 'nameofpod3', '~> 3.3'
  pod 'nameofpod4', '~> 4.4'
end

target 'SubWorkspace' do
  platform :ios, '8.0'
  xcodeproj 'SubWorkspace/SubWorkspace.xcodeproj'
  pod 'nameofpod3', '~> 3.3'
end

And then run FinalWorkspace.xcworkspace.

+5
source

All Articles