X和Y都实现了类X.将使用两者之一 [英] Class X is implemented in both Y and Z. One of the two will be used
问题描述
我有一个Objective-C工具"(控制台)程序,该程序在运行时动态加载Objective-C软件包.某些捆绑软件文件共享来自同一框架的类,因此我将类同时在...中实现"消息转储到控制台.
I've got an objective-c "tool" (console) program that dynamically loads objective-c bundle's at runtime. Some of the bundle files share classes from the same framework so I get the "Class is implemented in both..." message dumped out to the Console.
这不会阻止任何操作,但是在控制台上显示消息有些烦人.有没有办法防止它们被扔在那里?有没有一种方法可以更改捆绑软件,以便它们都不编译/链接相同的类?
It doesn't prevent anything from working, but having the messages on the console is somewhat annoying. Is there a way to prevent them from being dumped out there? Is there a way that the bundle's could be changed so they don't both compile/link the same classes?
推荐答案
-
如果它们是不同的实现,请使用唯一的前缀.
If they are different implementations, use a unique prefix.
如果它们是相同的实现,并且只是由多个图像导出,请重新配置目标,使其仅由一个图像导出.
If they're the same implementation and just exported by more than one image, reconfigure your targets so it's exported by only one.
特别是:
有没有一种方法可以更改包的类,使它们不都编译/链接相同的类?
Is there a way that the bundle's could be changed so they don't both compile/link the same classes?
将这些共享类填充到一个单独的框架中,不要将它们作为捆绑软件的一部分进行编译-只需将捆绑软件链接到共享内容的框架即可.
Stuff those shared classes in a separate framework, and do not compile them as part of the bundle -- just link the bundle to the framework of shared stuff.
这篇关于X和Y都实现了类X.将使用两者之一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!