1. /Users/xxx/.cocoapods/repos 不管是搭建私有库还是开源库,这个路径下版本库repos备份保存一份,相信老夫,往后你就知道了。
2.cd 项目路径
创建.podspec
搭建新项目 建议
pod lib create xxx.podspec
已有项目
pod spec create 'xxx'
3.编辑.podspec (这个嘛,其实最权威的是搜https://github.com/可以看别人怎么写的),下面提供一个版本
画线部分必须填对
接着走
4.校验.podspec文件
$ pod lib lint
WARN | [iOS] swift: The validator used Swift 3.2 by default because no Swift version was specified. To specify a Swift version during validation, add the `swift_version` attribute in your podspec. Note that usage of the `--swift-version` parameter or a `.swift-version` file is now deprecated.
加个swift版本支持
$ echo "4.0" > .swift-version
当出现下面这一行,则预示着校验成功
xx passed validation.
5.推到开源repo中
pod trunk push ICOpen.podspec
[!] CocoaPods was not able to update the `master` repo. If this is an unexpected issue and persists you can inspect it running `pod repo update --verbose`
$ pod repo update --verbose (该过程可能会很长,耐心等待,可能需要10分钟左右,如果还是报以上错误,把xcode退出,再来一次,再来2次)
然后你会和我一样出现下面结果
success
没错你成功了
6.享受战果
pod search xx
如果你的是这样
[!] Unable to find a pod with name, author, summary, or description matching `icopen`
那么换个姿势吧 先清空一下索引json
# delete cached index
rm ~/Library/Caches/CocoaPods/search_index.json
# search again
$ pod search xx
继续
pod search xx











网友评论