美文网首页
打包静态库 .a .framework

打包静态库 .a .framework

作者: 寂寞先森666 | 来源:发表于2019-07-19 16:52 被阅读0次

************************* .a 静态库 ****************************
第一、制造静态库.a 文件


屏幕快照 2019-07-19 下午4.30.58.png 屏幕快照 2019-07-19 下午4.41.41.png
#import <Foundation/Foundation.h>

@interface showMessage : NSObject
+(void)show;
@end
#import "showMessage.h"

@implementation showMessage
+(void)show
{
    NSLog(@"hello world");
}
@end

运行之后

屏幕快照 2019-07-19 下午4.43.17.png 屏幕快照 2019-07-19 下午4.44.17.png

第二步、把静态库.a 拉入到工程中使用

屏幕快照 2019-07-19 下午4.46.59.png
#import "Debug-iphonesimulator/include/showMessage/showMessage.h"
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{

    [showMessage show];
}

2019-07-19 16:26:26.710072+0800 测试iqKey[55545:4411576] hello world
2019-07-19 16:26:26.945118+0800 测试iqKey[55545:4411576] hello world
2019-07-19 16:26:27.114899+0800 测试iqKey[55545:4411576] hello world

注意、用模拟器打包的.a 只能用于模拟器运行,用真机打包的.a 只能用于真机运行

shoubindeMacBook-Pro:~ shoubintao$ cd 目录下

shoubindeMacBook-Pro:Debug-iphonesimulator shoubintao$ lipo -info libshowMessage.a
Non-fat file: libshowMessage.a is architecture: x86_64

************************* .framework 静态库 ****************************


屏幕快照 2019-07-19 下午5.48.44.png Static Library 静态库、Dynamic Library动态库 屏幕快照 2019-07-19 下午5.47.09.png 屏幕快照 2019-07-19 下午5.46.43.png

相关文章

网友评论

      本文标题:打包静态库 .a .framework

      本文链接:https://www.haomeiwen.com/subject/pheslctx.html