Class is implemented in both (...)

I have seen that in the past, but in my situation I don't get why..


- I have a static OS X framework, let's call it MyFramework.framework.

- This framework links against a custom library, libMyStaticLibrary that contains a class MyClass.

- MyClass.h is made public in the headers of MyFramework, and MyFramework.h has #import <MyFramework/MyClass.h>

- I have an OSX app, MyApp, that links with MyFramework.framework, and makes usage of MyClass...


When I go debugging and start doing a print object in lldb, I am prompt this:

objc[69744]: Class MyClass is implemented in both /Users/(...)/DerivedData/MyApp/Build/Products/Debug/MyApp.app/Contents/MacOS/MyApp and /Library/Frameworks/MyFramework.framework/MyFramework. One of the two will be used. Which one is undefined.


I would like to solve this issue, even though it doesn't seem to be a big deal..

Answered by quentinf in 142189022

So...this is unexpected. At some point during the development of MyFramework I probably tried to "install" it but shouldn't have. It is a static framework that I link with. Thanks QuinceyMorris, you pointed at the right thing bringin up /Library, I removed the MyFramework.framework that was installed in /Library and this message doesn't show up anymore.

I would either change the class name or not link against your custom library.

>> This framework links against a custom library, libMyStaticLibrary that contains a class MyClass.


This misrepresents the situation, if libMyStaticLibrary is actually a static library. It's linked *into* MyFramework, in the sense that it's part of MyFramework's code.


Your debugger message suggests it's also linked *into* the app. So it sounds like you added libMyStaticLibrary for the app to link "against". If so, you should not do that. The class is already in the framework.

Your answer makes sense, and so that's the class goes into MyFramework is what's intended. However the app doesn't link against libMyStaticLibrary.

The other possibility is that there's something in your MyClass.h file that's being treated as a declaration. Obviously, if you had an @implementation in there, that would be a problem. I doubt that's what you've done, but perhaps there's something subtler going on.


Also, although the error message isn't consistent with this hypothesis, it might just be the debugger information for MyClass that is duplicated. Is this a release or debug version of MyFramework that you've installed in /Library?

Accepted Answer

So...this is unexpected. At some point during the development of MyFramework I probably tried to "install" it but shouldn't have. It is a static framework that I link with. Thanks QuinceyMorris, you pointed at the right thing bringin up /Library, I removed the MyFramework.framework that was installed in /Library and this message doesn't show up anymore.

swiping my simulator helped: device > erase all content and settings

Class is implemented in both (...)
 
 
Q