Preparation of Knowledge:
1. What is a library?
A library is a collection of program code, a way to share program code
2. Depending on the disclosure of the source code, the library can be divided into 2 types
A. Open Source Library
Open source code, can see concrete implementation, such as Sdwebimage, afnetworking
B. Closed Source Library
Unfair open source code, is a compiled binary file, do not see the specific implementation. Mainly divided into: static library, dynamic library
3. The existence form of static and dynamic libraries
Static libraries:. A and. Framework
Dynamic libraries:. Dylib and. Framework
4. The difference between static and dynamic libraries in use
Static libraries: When linked, the static library is completely copied to the executable file, and multiple copies are redundant.
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.
5. the creation of a static library may be for several reasons:
1. You want to share the tool code or the third-party plugin quickly to other people without having to copy a large number of files.
2. You want to get some general-purpose code under your control so that it can be repaired and upgraded.
3. You want to share the library with others, but don't want them to see your source code.
4. For example, the very old framework uses the framework below the MRC environment, so we just need to package it into a static library, so we don't have to worry about the arc environment.
Xcode creates a static library in detail (Cocoa Touch Static library) (I'm using version 6.3)
Create a static library file (. a file)
Open Xcode, select file----> New---> Project.
Select iOS----> Framework & Library---> Cocoa Touch Static Library.
Click Next. Create the project step-by-step with the process.
Note the version of the static library file (4 types)
1. Real machine-d2. Real Machine-release version
3. Simulator-debug Version
4. Simulator-release Version
Debug version (Debug version) VS release version (release version)
--------------------------------------------------------------------------------
-The debug version will contain complete symbolic information for easy debugging
-The debug version does not optimize the code
-The release version does not contain complete symbolic information
-The execution code of the release version is optimized
-The release version size is slightly smaller than the debug version
-The debug version is faster in terms of execution speed, but does not mean a significant increase
iOS Static Library Summary