Cocoapods in subproject

泄露秘密 提交于 2019-12-22 04:44:22

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/26394463/cocoapods-in-subproject

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!