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

北城余情 提交于 2019-11-29 22:10:41

For closed-source static libraries we recommend cocoapods-packager. I'm not sure it's support for frameworks though.

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.

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.

One solution is to turn on use_frameworks! in the framework's Podfile. Then you still could make your framework compiled, and embed your framework in the target app. The warning messages will disappear (It is simply because framework's pods are complied to another framework, but you don't embed this one in your target app. Then your app will refer to the binary of its own.)

But this is not a good solution for two reasons: 1. You need to make sure the target app include the necessary pods that the framework needs. 2. The app might use different pod version to the framework. If both framework and app refer to the same pod binary, it could lead to crash.

I doubt there is a good solution for this issue.

If you want a quick solution - just add your MyFramework project as a subproject to MyApplication project. You can still use cocoa pods both for your framework and test application (but include your "common" lib with pods only to framework project)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!