iOS-开发

iOS 项目打包framework

2018-11-20  本文已影响47人  tongyuling

一、先创建一个静态库工程,选择framework

1

二、把项目中使用的三方框架 用cocoapods 生成

三、把需要打包的项目文件直接拖进来

2

四、创建一个单利或者是你自己写好的方法也是可以的

3

五、

六、

七、如果你原来的工程中包含有PCH文件,这时你需要在静态库工程中重新修改下它的路径,再添加一次即可

八、配置

九、真机版本和模拟器版本framework 合并

十、Bundle 的制作

1、framework中定义宏:
//bundle图片
#define csBundle_Name @"imageceshi.bundle"
#define csBundle_Path [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:csBundle_Name]
#define csBundle [NSBundle bundleWithPath:csBundle_Path]

2、图片调用修改为:
xxx.image = [UIImage imageNamed:@"" inBundle:csBundle compatibleWithTraitCollection:nil];



问题:

1、解决分类(使用)
iOS 程序引入framework 类别报错unrecognized selector sent to class


解决分类问题

2、bundle带来的打包失败:


bundle带来的打包失败问题 解决方法
3、framework推荐如下设置:
Mach-O Type > Static Library;( 静态库,如果需要提审 Appstore 的话不允许使用动态库的)
Dead Code Stripping > NO;(是否消除无效代码)
Link With Standard Libraries 默认是YES,如果没有特殊要求的话,默认就可以。(设为 NO 要配置Other Linker Flags)
Enable Bitcode > NO;(支持旧库)
上一篇 下一篇

猜你喜欢

热点阅读