1、创建Cocoa Touch Framework 工程;
2、删除原有的.h文件,创建与工程同名的类或者导入与工程同名的类(即导入需要打包成framework的代码);
3、Xcode 参数配置
"Build Active Architecture Only" 设置为 "NO"
"Dead Code Stripping" 设置为 "NO"
"Link With Standard Libraries" 设置为 "NO"
"Mach-O Type" 设置为 "Static Library"
设置"IOS Deployment Target" 设置为 "IOS 7.0" ,表示支持IOS7.0以上系统版本的编译,添加兼容的最低版本
4、设置需要导出的头文件跟隐藏的文件
5、分别在模拟器跟真机运行,即可做出相关framework
6、Xcode 警告“ Block implicitly retains 'self';explicitly mention 'self' to indicate this is intended behavior Insert'self->'”,取消警告方法“Build Settings”->"Apple LLVM 9.0 - Warnings - Objective C and ARC"->"Implicit retain of 'self' within blocks" 设为 "NO"
7、framework支付bitcode。如果你正在开发.a静态库或者framework,请注意打包方式设置为archive,或者在打包脚本中加入-fembed-bitcode参数。如果需要的话,需要在Build Settings中打开 DEPLOYMENT_POSTPROCESSING=YES,设置Strip Style为debugging。
网友评论