The role of .a files
Some functions in the project need to be used by others, but do not want to disclose the core code. For example, Alipay, WeChat and other third parties have .a files
How to make .a files
1. Create a new project, select Static Library
2. In order to ensure that the generated static library can run on various devices, you need to modify Build Active Architecture Only to NO
Write an output method and expose it in the header file
@interface TestStaticLibrary : NSObject
+(void)pringString;
@end
@implementation TestStaticLibrary
+(void)pringString{
NSLog(@"第一个.a文件");
}
Choose any simulator to compile once, and then choose the real machine to compile once, you can see that the .a file under Produts turns red.
show in finder can find these two .a files
Merge these two .a files
Command format:
lipo -create the absolute path of the first .a file and the absolute path of the second .a file -output the path of the final .a file/xxx.a
View the information of the .a file
lipo info ".a地址"
How to use static libraries
To create a new project, drag the .a file and header file into it, you can use it, as shown in the figure: