即上一篇iOS之使用Cocoapods创建公有仓库,本文就CocoaPods创建公有库踩到的坑做一下分享:

Paste_Image.png
解决办法:
重新打开xxx.podspec文件编辑一下,确定共享文件路径没有错误,然后再上传到github上验证。
source_files文件格式有几种设置方法:
s.source_files = 'Classes/*.{h,m}'
s.source_files = 'Classes/publicClass.{h,m}'
s.source_files = 'Classes'
s.source_files = 'Classes/**/*.{h,m}'pod trunk push TestCocoaPods.podspec时,报[!] {"name"=>["is already taken"]}

Paste_Image.png
解决办法:
执行pod search TestCocoaPods,会发现有一个重名的公有库存在,重新创建一个公有库,CocoaPods不允许有重名的公有库存在。
pod search仍然搜索不到。
Paste_Image.png
解决办法:
1、执行pod setup

Paste_Image.png
如果最底下会输出setup completed。说明执行pod setup成功。
2、如果pod search操作还是搜索失败,删除~/Library/Caches/CocoaPods目录下的search_index.json文件。
rm ~/Library/Caches/CocoaPods/search_index.json 3、执行pod search

Paste_Image.png