首先提供SDWebImage下载链接地址:SDWebImage GitHub
1.构建框架文件
下载完成master.zip包后,进行解压缩得到SDWebImage-master文件夹

打开SDWebImage-master文件夹,找到SDWebImage.xcodeproj项目文件,打开xcodeproj文件,注意打开项目文件后不要Build项目(按照SDWebImage官方构建指南说明来)


打开项目后,在工程目录下(或者全局搜索skip关键字)找到Module-Shared.xcconfig文件,修改SKIP_INSTALL为NO


然后使用Archive来构建SDWebImage框架。点击Xcode菜单栏Product->Archive进行归档

弹出归档文件列表窗口,点击Distribute Content按钮开始构建发布

弹出导出文件选项窗口,选择Built Products,点击Next按钮开始导出框架文件

导出完成后会生成一个文件夹,打开文件夹,在文件夹目录下找到SDWebImage.framework文件,就是最终生成的SDWebImage框架文件,至此构建SDWebImage框架的工作完成。

2.项目集成SDWebImage框架
将生成的SDWebImage.framework文件导入(拖拽或Add Files)到工程中,并在使用的地方引入头文件


真机编译运行成功,说明SDWebImage框架集成完成,如果运行失败报出以下错误

这是因为导入的SDWebImage框架没有代码签名,需要对SDWebImage框架签名,点击General->Frameworks,Libraries,and Embedded Content找到SDWebImage.framework项修改Embed值为Embed & Sign,再编译运行项目

如果想具体查看原因可以修改Embed值为Embed Without Signing再编译运行项目,会弹窗异常窗口,点击查看详情日志



最后再附上SDWebImage下载链接:SDWebImage GitHub
以上内容如有侵权,请联系删除。
网友评论