子项目中的可可足类 [英] Cocoapods in subproject

查看:83
本文介绍了子项目中的可可足类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有子项目的项目。子项目和主项目都必须使用Cocoapods来集成一个库,如果没有Cocoapods,这似乎是不可能集成的。因此,我为主要项目及其子项目都设置了Cocoapods。子项目在其生成的工作空间中生成,但是编译主项目会产生以下错误:ld:找不到针对-lPods-子项目名称-库的库。

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.

我现在唯一的想法是,我应该以某种方式让子项目的Cocoapods存储库使用主项目的名称,以便在子项目构建时将检查主项目的名称。与主项目的Cocoapods生成的库相同(大概是-lPods-主项目名称-库),这些库将在主项目的构建过程中创建。

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?

推荐答案

尝试以这种方式编写您的podfile:

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

然后运行FinalWorkspace.xcworkspace。

And then run FinalWorkspace.xcworkspace.

这篇关于子项目中的可可足类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆