问题
I'm working on an iOS framework project which is using a third-party framework classes so I added third-party framework under Linked frameworks and libraries section.
When I add my custom framework in my iOS app project, I'm getting this warning for each class
objc[3139]: Class 'class_name' is implemented in both /private/var/containers/Bundle/Application/C131AF0F-7CF8-4360-8716-3E8A595169D6/'app_name'.app/Frameworks/'framework_name'.framework/'framework_name' and /var/containers/Bundle/Application/C131AF0F-7CF8-4360-8716-3E8A595169D6/'app_name'.app/'app_name'. One of the two will be used. Which one is undefined.
iOS app project is also linked with that third-party framework. So I think getting this issue because my framework also contains compiled version of third-party framework.
I didn't find any proper solution for this. Can anyone tell me how to get rid of this?
Is there any way i can make it work?
回答1:
tl;dr Don't link the third-party framework in your application target's Build Phases. Use Link Frameworks Automatically
instead.
To make this a little more clear, let me give an example. There is a third-party framework called CrashReporter.framework. The custom framework is called HockeySDK.framework (which links to CrashReporter.framework). Then I have my application called WeatherApp (which links to HockeySDK.framework).
CrashReporter.framework <---
^ |
| |
| X X X NO! DONT'T LINK THIS!
HockeySDK.framework |
^ |
| |
| |
WeatherApp -----------------
I do not link CrashReporter.framework in the Link Binary With Libraries section of Build Phases in the WeatherApp target (even though Weather app needs CrashReproter.framework to build). I go to the Build Settings of the WeatherApp target and ensure Link Frameworks Automatically
(and Enable Modules (C and Objective-C)
if on iOS) is set to Yes
.
来源:https://stackoverflow.com/questions/37897350/ios-framework-issue-class-is-implemented-in-both