类是在两者中实现的。将使用两者之一

类是在两者中实现的。将使用两者之一

问题描述:

我有一个使用SocketRocket的依赖项(通过CocoaPods安装)并从HeapAnalytics导入静态库的项目。显然,HeapAnalytics库已经使用了SocketRocket。编译时没有错误,但在运行时收到以下内容:

I have a project that has a dependency (installed via CocoaPods) using SocketRocket and have imported a static library from HeapAnalytics. Apparently the HeapAnalytics library already uses SocketRocket. I get no errors when compiling, but at runtime receive the following:

Class SRWebSocket is implemented in both [path] and [path].
One of the two will be used. Which one is undefined.

我不知道如何处理它,因为我见过的大多数解决方案都需要编译静态库你自己改变了类名等,而且我没有访问源。

I'm not sure how to handle it because most solutions I've seen require compiling the static library yourself change class names and such, and I don't have access to the source.

有什么建议吗?

我写了这条错误信息!•

I wrote that error message!•

更改类名或不链接到所述库。

Either change the class name or don't link against said library.

您的项目是如何配置的?有没有明确链接SR的地方?或者它是否链接两个已经包含SR的静态库的产品?

How is your project configured? Is there anywhere where you explicitly link against SR? Or is it a product of linking against two static libraries that both already include SR?

如果是前者,则直接停止与SR的链接并继承随附的版本库已经使用它(警告:确保它有正确的版本)。

If the former, then stop linking against SR directly and just inherit the version that came with the library already using it (warning: make sure it has the right version).

如果是后者,那么你将不得不修改其中一个库。

If the latter, then you are going to have to modify one of the libraries.

•实际上,我修改了错误。过去常常暗示会使用其中一种。但事实并非如此,并且不同平台的行为也不同。因此,对它进行了更改,以便更准确地确定行为未定义。

• Actually, I modified the error. It used to imply that one or the other would be used. But that wasn't really what was going on and the behavior was different across different platforms. Thus, it was changed so that it was far more precise in identifying that the behavior was undefined.