Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoapods in subproject

Tags:

cocoapods

I have a project with a subproject. Both the subproject and the main project must use Cocoapods to integrate a library which is seemingly impossible to integrate without Cocoapods. So I have Cocoapods set up for both the Main project and its subproject. The subproject builds in its generated workspace, but compiling the main project produces the following error: ld: library not found for -lPods-Subproject name-Library.

The only idea I have right now is that I should somehow get the subproject's Cocoapods repo to use the main project's name, so that when the subproject builds it will check for the same libraries as the main project's Cocoapods generates (presumably -lPods-Main Project Name-Library), which will have been created as part of the main project's build process.

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

like image 987
Ben Pious Avatar asked Oct 16 '14 00:10

Ben Pious


People also ask

Where CocoaPods is located on mac?

By default CocoaPods stores repositories in your home folder in ~/. cocoapods and caches Pods in ~/Library/Caches/CocoaPods .


1 Answers

Try to write your podfile in that 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.

like image 58
euthimis87 Avatar answered Sep 23 '22 02:09

euthimis87