IOS development-function-static library and ios development function static
1. overview: apple's development mainly provides two types of libraries: static libraries and built-in libraries. framework and self-created. file a is mainly called during compilation, and a dynamic library is mainly used. the end of dylib (or directly. o file), which is created at runtime. the o file is linked to the project file for calling. Apple currently only provides static library encapsulation. Next we will introduce the encapsulation of. a static library.
2. Functions: Mainly used for two purposes: 1). modular functions for reuse; 2) internal implementation of confidential source files to protect the privacy of source files.
3. step: Create a new project file-> select cocoa touch static library-> Create for others to call. h and. m file->. h and. file. the interface functions provided in the H file must be exposed to function interfaces that need to be called by others. in the H file-> because the framework is a static library, it is finally compiled and generated. file a-> locate the file location in products-> Add it to the project to be referenced. file a and the corresponding. h header file (note link binary with library link ). Note: in fact, the. a file is a set of. m files. The. m file is called Based on the packaged. h file.
4. Example: 1.2.3.456
7.8.9.10
5. Problem: 1). Pay attention to the release and debug Versions in Product-> scheme.
2) If the. a file is red after compilation, it indicates that it is not successful. You can switch to the directory of the simulator and device project to generate the black. a file.
3 ). note: Because the simulator is on mac, the cpu architecture is x86 and the arm architecture of devices such as the iPhone is different, we can view the generated file lipo-info xxx. a. if you want to use it at the same time, use lipo-create... /simulator/xxx. a... /device/xxx. a-output... /output location/xxx. a.