简体   繁体   English

iOS静态框架和静态库

[英]iOS static framework and static library

This link discusses how to create iOS static framework, and they said 这个链接讨论了如何创建iOS静态框架,他们说

With static libraries, everything else (including the header files) you must distribute separately. 对于静态库,您必须单独分发所有其他内容(包括头文件)。

Actually I found no difference between using static lib and framework, you can look at the Admob SDK ( https://developers.google.com/mobile-ads-sdk/docs/ ), what they ask is just pull all the files in the XCode project, so I really don't understand why we need to use framework over just plain static lib, or am I missing something? 实际上,我发现使用静态库和框架没有什么区别,您可以查看Admob SDK( https://developers.google.com/mobile-ads-sdk/docs/ ),他们要求的只是将所有文件拉入XCode项目,所以我真的不明白为什么我们需要在纯静态lib之上使用框架,还是我缺少一些东西?

Basically a framework is a collection of static libraries (eg one for i386, one for ARM) and the header files. 基本上,框架是静态库(例如,用于i386的一个,用于ARM的一个)和头文件的集合。 Furthermore a framework also is a special folder with a very well defined structure. 此外,框架也是具有良好定义的结构的特殊文件夹。

I am not quit sure what you mean by 'just add the folder in Xcode'... If you mean adding a folder containing all the source code or a folder containing the static library including the header files you are right and there (very often) is no really big difference (depending on the library to include). 我不知道您的意思是“仅在Xcode中添加文件夹” ...如果您的意思是添加包含所有源代码的文件夹或包含静态库(包括头文件)的文件夹,那么您是对的(很多时候) )并没有太大的区别(取决于要包含的库)。

Using a framework is primarily a usability thing. 使用框架主要是可用性问题。 Adding a framework, which means adding one single artifact, is less error prone than adding a bunch of files. 添加框架(意味着添加一个工件)比添加一堆文件要容易出错。 For example it is not possible to accidentally omit one header file. 例如,不可能意外地忽略一个头文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM