First, what is a library?
Library is the way to share program code, generally divided into static library and dynamic library.
Second, the static library and the dynamic library of the difference?
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.
Note: iOS uses dynamic library shelves AppStore will be rejected
Third, the form of static library in iOS?
. A and. Framework
Iv. Dynamic Library form in iOS?
. Dylib and. Framework
V. Why is the framework a static and dynamic library?
The. Framework of a system is a dynamic library, which we build ourselves. The framework is a static library.
What is the difference between a and. Framework?
. 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.
Vii. 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.
Eight, the production of static Library of several notes:
1 Note: either the. A static library or the. Framework static library, all we need is a binary file +.h+ other resource files, different,. A is itself a binary file, We need our own. h and other files to use, and. The framework itself already contains. h and other files that can be used directly.
2 Image Resources processing: two static libraries, usually the picture file is placed in a separate. bundle file, general. The name of the bundle is the same as the name of the. A or. Framework. bundle files are good, create a new folder, Rename it to. Bundle on it, right-click to display the contents of the package to which you can add a picture resource.
3 category is often used in our actual development projects, it is no problem to make the category into a static library, but in the project using this static library, there will be no run-time error to find the method when calling the method in the category (selector not recognized), the workaround is to configure other linker flags with a value of-OBJC in a project that uses a static library.
4 If a static library is complex, If you need to expose the. h more, you can create an. h file inside the static library (typically the name of the. h file is the same as the name of the static library), and then put all of the. h files that need to be exposed in this. h file, and those that need to be exposed. h no longer need to be exposed, just expose the. h.
IOS. A and. FRAMEWOFK