1、用xcworkspace創(chuàng)建和管理多個項(xiàng)目可以實(shí)現(xiàn)s d k封裝
2界轩、在項(xiàng)目里點(diǎn)擊加號也可以創(chuàng)建framework,以上兩個方法都能打包sdk
3、如果sdk里引用了其他sdk,添加的時候不勾選add to targets
4肩狂、fremawork就是sdk,暫時這樣考慮姥饰,pch文件也可以使用
5傻谁、boundle文件編譯到framework中,圖片是可以訪問到列粪,但是打包的時候提示報錯审磁,等有時間再看看怎么方便地讀取framework中的圖片,省的放2個文件
6岂座、引入cnplayer sdk時候報錯态蒂,刪掉創(chuàng)建framework文件的默認(rèn).h文件就可以了
7、一直提煉代碼费什,等代碼很完美的時候钾恢,再封包也行
8、控制暴露接口的.h,控制開源目錄
9瘩蚪、目錄控制注意依賴關(guān)系刑桑,要不然pod lib lint不會通過(踩坑了)
10、編譯不通過募舟,把.h頭文件拖到public下面就可以
11祠斧、引用framework圖片宏定義
//bundle文件
#define bundleImg(imgName)\
({\
NSBundle *framework =[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"ZDAdSDK" ofType:@"framework" inDirectory:@"Frameworks"]];\
NSBundle *bundle = [NSBundle bundleWithPath:[framework pathForResource:@"ZDAd" ofType:@"bundle"]];\
NSString *path =[NSString stringWithFormat:@"%@/%@",bundle.resourcePath, imgName];\
(path);\
})\
//car文件
#define carImg(imgName)\
({\
NSString *path = [[NSBundle mainBundle] pathForResource:@"ZDAdSDK" ofType:@"framework" inDirectory:@"Frameworks"];\
NSBundle *bundle = [NSBundle bundleWithPath:path];\
UIImage *img = [UIImage imageNamed:imgName inBundle:bundle compatibleWithTraitCollection:nil];\
(img);\
})\
調(diào)用:
[cloBtn setImage:[UIImage imageNamed:bundleImg(@"guanbi")] forState:UIControlStateNormal];
[cloBtn setImage:carImg(@"close") forState:UIControlStateNormal];