CocoaPods搜索不到最新库

场景:gitHub上已经更新了最新的库,但是cocoapods却搜索不到,我这里以HandyJSON库为例。
安装HandyJSON 5.0.0版本。

pod install 
        
Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "HandyJSON":
  In snapshot (Podfile.lock):
    HandyJSON (= 5.0.0, ~> 5.0.0)

  In Podfile:
    HandyJSON (~> 5.0.0)

None of your spec sources contain a spec satisfying the dependencies: `HandyJSON (~> 5.0.0), HandyJSON (= 5.0.0, ~> 5.0.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

报错没有5.0.0版本。

#查看库版本 发现果然没有5.0.0版本
pod search HandyJSON 

1、鉴于以上错误,按照提示更新repo

pod repo update
可能报错,注意: `xxxxxx` != `master`
[!] CocoaPods was not able to update the `xxxxxx` repo. If this is an unexpected issue and persists you can inspect it running `pod repo update --verbose`

这里报错可能是因为你本地的repos中又多个索引库文件,其中一个库在执行更新时出错,导致最终的更新失败。
在这里插入图片描述
在这里我们只需要更新master库即可,故执行命令

pod repo update master 

更新成功。
再安装HandyJSON 5.0.0版本成功了。

  • 可能遇到问题: pod repo update master 报错
[!] 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`

解决:退出终端重新打开运行更新,又成功了。很奇怪。

备注:显示隐式文件—— cmd+shift+.
以上仅是记录自己在使用CocoaPods中遇到的问题,请视情况借鉴。

猜你喜欢

转载自blog.csdn.net/haifangnihao/article/details/97113325
今日推荐