1、创建私有库:pod lib create XXX
2、验证私有库:pod lib lint XXX (本地验证),pod spec lint XXX (本地和远程验证),
如果当前私有库引用到了其他私有库,需要使用第二种方式,并指明地址引用的私有版本库地址,示例:pod spec lint XXX.podspec --sources='http://192.16.0.xx/iOS-APP/XXX.git,https://github.com/CocoaPods/Specs.git' --allow-warnings --use-libraries --verbose
参数说明:
--sources:引用的私有库地址,如果引用到其他第三方的库,记得一定加上https://github.com/CocoaPods/Specs.git,多个地址以逗号“,”分割。如果没有引用到其他的私有版本库,这个参数可以不加,示例:pod spec lint XXX.podspec --allow-warnings --use-libraries --verbose
--allow-warnings:允许警告,如果不加这个可能会由于项目里太多警告而验证不通过,一般都加上
--use-libraries:有引用到静态库,添加此参数
--verbose:输出详细日志
3、push到远程私有中央库
先在远程添加一个私有版本库xxx.git,然后将其添加到pod仓库索引:pod repo add xxxx http://xxxx/xxx.git
push到远程私有版本库:pod repo push xxxx xxx.podspec --sources='http://192.16.0.xx/iOS-APP/xxx.git,https://github.com/CocoaPods/Specs.git' --allow-warnings --use-libraries --verbose
参数说明同上。
4、如遇到问题Could not find a `ios` simulator (valid values: ). Ensure that Xcode -> Window -> Devices has at least one `ios` simulator listed or otherwise add one.
这是Xcode版本和pod依赖的组件fourflusher不匹配导致
将fourflusher卸载重新安装即可
sudo gem uninstall fourflusher
sudo gem install fourflusher
注意:验证和提交时,先打对应版本tag,本地.podspec文件中的版本在远程一定要有对应tag
本文只介绍了验证和提交,具体的怎么从头开始搭建我们自己的私有版本库,等有时间了整理发出来。