What is the proper way of distributing a dynamic framework with a dependency on a static framework?

放肆的年华 提交于 2019-12-22 08:26:51

问题


I'm building a closed source dynamic framework. It has a dependency on a 3rd party closed source static framework.

I link the static dependency framework to my framework's project/target as described in this Apple tech note:

That same Apple tech note mentions:

The app target is responsible for embedding all of the frameworks, including any frameworks that other frameworks depend on.

So I also give my clients a copy of the framework I depend on. However, further down in the same tech note, Apple (referring to embedding static libraries/frameworks) states:

Since the binary in these situations is a static library, apps cannot embed it in the app bundle.

...The library should remain in the "Link Binary with Libraries" section.

That's fine - so I just have my clients link the static framework dependency instead of embed it and everything works fine.

However, problems arise when my client needs the -ObjC linker flag for other libraries they use. This linker flag causes my (objective-c) static framework dependency to load all of its classes twice and the client sees duplicate class logs everywhere in their console.

One possible solution here would be to have the client identify the libraries they use which need the -ObjC linker flag and instead specify the force_load flag for those libraries. But this solution also causes problems in the case of the client using CocoaPods since CocoaPods will overwrite any changes to their linker flags with -ObjC again with each pod install. Are there any other solutions/ideas anyone has to this problem?

P.S. I know the Apple tech note from before also mentions:

Static frameworks are not a supported way of sharing static libraries.

but unfortunately my hands are tied from business constraints at the moment, and I must include this static framework dependency.

来源:https://stackoverflow.com/questions/47208950/what-is-the-proper-way-of-distributing-a-dynamic-framework-with-a-dependency-on

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