在终端输入以下命令进行安装或者升级
旧版本cocoapods需升级最新的,之前在这遇到坑
$ sudo gem install cocoapods
制作cocoaPods库详细
1、终端cd到自定义文件夹
2、pod lib create xxx(把它换成你的库的名字),回车

之后出现一堆配置 根据需求自己选择

3、结束后会自动打开创建的工程
替换需制作的cocoapod文件、修改 .podspec 文件

上方demo需要运行 pods中自己添加的文件
cd到Example目录下,完成demo编写后把需要被pod的文件放入下方替换ReplaceMe.m文件
pod install 跑起来, cmd+r success后就好啦!!!
修改后的.podspec文件

下方的s.dependency 为外部依赖库,根据需求修改,打开#注释
多个就写多个

4、修改完后,在github上创建项目,并把内容push上去
$ git add .
$ git commit -m "描述信息"
$ git push
5、接下来注册一个 trunk 的 session。打开终端,输入 pod trunk register zhangrongwu@sina.cn zhangrongwu(输入自己的,别输入这个)
就是注册验证过程
pod trunk me 验证是否成功
6、回到终端 cd到项目目录执行 将自己的 spec 文件上传到 cocoapods 的 trunk 服务器
pod lib lint xxx
xxx 为自己项目名称,库中后缀名为 .podspec 的文件的名字
等待结束后 输入
pod trunk push xxx.podspec --verbose
等待结束后 去验证自己的内容打开终端执行
pod search xxx
坑一:提交version流程
1 、git add .
2、 git commit -m "version"
3、 git push --tags
4、 git push -u origin master
坑二:制作完成后,尼玛这什么鬼,找不到。

执行: rm ~/Library/Caches/CocoaPods/search_index.json
再不行就重新安装cocoapods
网友评论