实现步骤:
pod lib create podName]
创建模板项目。该命令会根据输入的信息自动创建名为podName的本地git仓库,在项目的根目录下自动创建了podName.podspec、readme.md、license文件,自动创建使用了podName库的Demo项目,在Pods工程下自动创建pod个人库开发文件夹。
问题解决:
1、个人库中如何使用图片资源?
以下是个人解决办法仅供参考
1)创建xxx.bundle,并将图片等资源放入其中
2)xxx.podspec中添加 [s.resource = 'FFMainView/Assets/FFMainView.bundle'],个人使用s.resource_bundles 格式进行多次尝试都没成功。
3)项目中使用时需要注意直接使用如image = [UIImage imageNamed:@""];是无法使用的,需要像下面这样使用
NSBundle *bundle = [NSBundle bundleForClass:NSClassFromString(@"FFMainView")];
NSString *bundlePath = [bundle pathForResource:@"FFMainView" ofType:@"bundle"];
NSBundle *resourceBundle = [NSBundle bundleWithPath:bundlePath];
UIImage *image = [UIImage imageNamed:imageName inBundle:resourceBundle compatibleWithTraitCollection:nil];
2、如下类型错误解决办法使用 --use-libraries (pod lib lint FFMainView.podspec --use-libraries)
- ERROR | xcodebuild: /Users/xjq/Library/Developer/Xcode/DerivedData/App-gxuditnllbdkaueteqzzcodtsism/Build/Products/Release-iphonesimulator/FFMainView/FFMainView.framework/Headers/FFMainView.h:20:9: error: include of non-modular header inside framework module 'FFMainView.FFMainView' [-Werror,-Wnon-modular-include-in-framework-module]
3、warning错误解决办法是使用 --allow-warnings,所以最终形式为[pod lib lint FFMainView.podspec --use-libraries --allow-warnings]
4、成功提交代码到trunk服务器,但是一直搜索不到个人库。
1)pod setup
2)rm ~/Library/Caches/CocoaPods/search_index.json
3)再次搜索
5、pod lib lint 正确,提交操作报错
解决办法:保存文件后,进入本地文件夹下删除该库的文件,尝试再次提交。