我不得不承认,随着 iOS 8 的发布,我对 iOS 中的动态和静态框架有些困惑.
I have to admit that with the release of iOS 8 I am a bit confused about dynamic and static frameworks in iOS.
我正在寻找一种方法来分发我创建的库,并且我需要支持 iOS 7 及更高版本.(注意:这将是一个专有框架.我不能使用可可豆荚,也不能分发源代码).以下是我已经知道的:
I am looking for a way to distribute a library that I created, and I need to support iOS 7 and above. (Note: This will be a proprietary framework. I cannot use cocoa pods, and I also cannot distribute the source). Here is what I already know:
以下是我关于此信息的问题:
And here are my questions regarding this information:
在 iOS8 之前,Xcode 只允许为 iOS 创建静态库的选项.常见的问题是我们必须分别发送二进制文件和头文件.
Before iOS8, Xcode only allowed the option of creating static libraries for iOS. The common problem with that was we had to ship the binary and headers separately.
后来,一些开发人员提出了创建静态框架"的想法.[.framework 只是一个带有符号链接到 lib 和标题的文件夹].一个这样的例子是 https://github.com/jverkoey/iOS-Framework
Later, some developers came with the idea of creating 'static frameworks'. [the .framework is just a folder with symbolic links to the lib and the headers]. One such example is https://github.com/jverkoey/iOS-Framework
此选项适用于 iOS 7 或 8 或更早版本.因为它们只是静态库,可以方便地捆绑头文件.
This option will work for iOS 7 or 8 or before that. Because they are just static libraries with the convenience of bundling the headers files along.
至于您对资源的问题,我们需要将它们捆绑在.bundle"中.为了运送它们,我不确定我们是否可以将它们包含在 .framework 文件夹中.过去我曾经运送我的库作为静态框架和捆绑包......
As for your questions of the resources, we would need to bundle them in '.bundle'.. For shipping them i am not sure if we can enclose them in the .framework folder.. In the past i used to ship my libs as a static framework and bundle...
但是,如果您使用 Swift,上述选项将不适合您.Xcode 不支持构建包含 swift 代码的静态库.
However the above option will not work for you if you use Swift. Xcode does not support building static libraries that include swift code.
如果要快速使用,您必须使用动态框架.理论上,动态框架在 iOS7 中工作.但是,如果应用程序针对 iOS7 并使用动态框架,我认为 iTunes Connect 会拒绝:-).
You must go with Dynamic frameworks if there is swift usage. In theory, Dynamic frameworks work in iOS7.. But, i think iTunes Connect will reject if the app is targeting iOS7 and uses Dynamic frameworks :-).
希望对你有帮助
这篇关于iOS 静态与动态框架说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!