X类在< framework>中都实现。和< application>将使用两种方法之一,其中一种是未定义的 [英] Class X is implemented in both <framework> and <application> one of the two will be used, which one is undefined

查看:87
本文介绍了X类在< framework>中都实现。和< application>将使用两种方法之一,其中一种是未定义的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此警告:

Class X is implemented in both <framework> and <application> one of the two will be used, which one is undefined

网络,但我没有找到能解决我所遇到的特定问题的东西。

This warning is covered quite a bit across the web but i haven't found anything that answers the specific problem I'm having.

场景

我已经构建了MyFramework和MyApplication(作为MyFramework的测试/演示应用程序)。

I've built MyFramework and MyApplication (as a test/demo application for MyFramework).

MyFramework使用了CocoaPod(我将其称为例如CoolPod),我也想在MyApplication中使用它(并且假设MyFramework的使用者也可以使用)。

MyFramework uses a CocoaPod (which I'll refer to as CoolPod), which I also want to use in MyApplication (and it is reasonable to assume a consumer of MyFramework would also).

我需要能够分发MyFramework作为.framework(适用于封闭源代码)。但是,这意味着MyFramework将CoolPod嵌入其已编译的库中。

I need to be able to distribute MyFramework as a .framework (for closed source). However, this means that MyFramework embeds CoolPod in its compiled library.

现在,当我将MyFramework和CoolPod导入MyApplication时,我会以CoolPod的形式出现此冲突(输出上述警告)类已经包含在MyFramework的库中(因为嵌入了CoolPod。)

Now when I import MyFramework and CoolPod into MyApplication I get this conflict (outputting the warning shown above) as CoolPod's classes are already included in MyFramework's library (as CoolPod is embedded).

因此我们具有以下结构:

So we have this structure:

CoolPod -> MyFramework \
                        MyApplication
               CoolPod /

问题

Question

如何避免这种冲突?


  • 我的MyApplication是否可以将CoolPod提供给MyFramework?

  • 是否必须管道通过MyFramework获得CoolPod的标头?

我曾考虑过在MyApplication中包含CoolPod的标头(但不包括其lib),但这似乎过于复杂

I've thought about including CoolPod's headers (but not its lib) in MyApplication, however this seems overly complex for what should be a simple case.

任何帮助都将不胜感激,这真的在阻止我。

Any help is greatly appreciated, this is really blocking me right now.

谢谢

靛蓝

推荐答案

我的解决方案是可可豆荚中的源代码,并为其创建一个可可触摸框架。然后,我将框架链接到我的api和测试应用程序。
这不是很好,但是我可以很快做。我相信Cocoapods正在开发支持框架,因此该解决方案可能很快就会过时。

My solution was to take the source code from the cocoa pod and create a Cocoa Touch Framework for it. Then I linked the framework to my api and to my test app. This isn't great but it is all I could do quickly. I believe Cocoapods is working on supporting frameworks so this solution may get outdated soon enough.

我的公司还使用gradle来实现依赖关系(java)和构建脚本。因此,我创建了一个Groovy / gradle构建任务,该任务构建了我的框架和我的支持框架(cocoapod框架),并从中创建了一个通用框架。然后压缩所有框架。这意味着我可以分发所有要求的拉链。显然,这不是最好的分发方式(我们将转向依赖于我们的封闭源框架的Cocoapods分发),但设置起来很快。

My company also uses gradle for dependencies (java) and build scripting. So I created a groovy/gradle build task that builds my framework and my supporting frameworks (cocoapod frameworks) and creates a universal framework from them. Then it zips all of the frameworks. This means I can distribute one zip with all of the requirements. This obviously isn't the nicest way to distribute (we'll be moving to distributing through Cocoapods with dependencies on our closed source frameworks), but it is fast to setup.

这篇关于X类在&lt; framework&gt;中都实现。和&lt; application&gt;将使用两种方法之一,其中一种是未定义的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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