First, what is a library?
Library is the way to share program code, generally divided into static library and dynamic library.
Static Library: When the link is completely copied to the executable file, multiple copies of the redundant copy are used.
Dynamic Library: Link is not copied, the program is dynamically loaded into memory by the system, for program calls, the system is loaded only once, multiple programs are shared, saving memory.
Second, form
Static Library form: . A and. Framework
Dynamic Library form:. Dylib and. Framework
Among them, the system's. Framework is a dynamic library, which we build ourselves. The framework is a static library.
. A is a pure binary file, and the. Framework has a resource file in addition to the binaries.
. A files cannot be used directly, at least with. h files, and. Framework files can be used directly.
. A +. H + sourcefile =. Framework.
Suggested use the. Framework.
Third, why use a static library?
Easy to share code for reasonable use.
Implement the modularity of iOS programs. A fixed business module can be made into a static library.
Share your code base with others, but don't want others to see your code implemented.
The need to develop a third-party SDK.
Four, limit
Apple officially does not allow users to launch their own dynamic library
The simplest difference, the dynamic library all apps share one copy, static library each app one copy
The reason why Apple does not allow a dynamic library is considered, for example, many apps use Friends League, if friends of the league is a dynamic cry, that in these apps through the Friends of the league Dynamic library to achieve data sharing and even privacy theft will be possible.
Differences between the iOS static library and the dynamic library