Cocoapods 指向错误的版本

Viv*_*ive 5 ruby gem cocoapods

我在项目的一个版本中遇到了一些问题。我找到了这个答案,有人建议从机器中删除所有与 cocoapods 连接的东西并重新安装它。我确实按照以下步骤操作:

$ 'pod --version'
0.36.1

$ gem list --local | grep cocoapods
cocoapods (0.39.0.rc.1, 0.38.2, 0.38.1, 0.37.2)
cocoapods-core (0.39.0.rc.1, 0.38.2, 0.38.1, 0.37.2)
cocoapods-downloader (0.9.3, 0.9.1)
cocoapods-plugins (0.4.2)
cocoapods-search (0.1.0)
cocoapods-stats (0.6.2, 0.5.3)
cocoapods-trunk (0.6.4, 0.6.1)
cocoapods-try (0.5.1, 0.4.5)

$ gem uninstall cocoapods // and all others from the list above
Run Code Online (Sandbox Code Playgroud)

问题是,当我再次 grep 所有 cocoapods 时,列表等于上一个,没有任何消失。

$ sudo gem uninstall cocoapods
Select gem to uninstall:
 1. cocoapods-0.37.2
 2. cocoapods-0.38.1
 3. cocoapods-0.38.2
 4. cocoapods-0.39.0.rc.1
 5. All versions
> 5

$ pod --version
// here was the error command not found, so everything fine

$ sudo gem install cocoapods
Fetching: cocoapods-0.38.2.gem (100%)
Successfully installed cocoapods-0.38.2
Parsing documentation for cocoapods-0.38.2
Installing ri documentation for cocoapods-0.38.2
Done installing documentation for cocoapods after 2 seconds
1 gem installed

$ pod --version
Could not find proper version of cocoapods (0.36.1) in any of the sources
Run `bundle install` to install missing gems.
Run Code Online (Sandbox Code Playgroud)

但是为什么它要我安装 0.36.1?无论如何,正如它所要求的那样,我做到了:

$bundle install
Installing cocoapods-core 0.36.1
Installing cocoapods-downloader 0.8.1
Installing cocoapods-plugins 0.4.1
Installing cocoapods-trunk 0.6.0
Installing cocoapods-try 0.4.3
Installing cocoapods 0.36.1
// Many "using" dependencies
Run Code Online (Sandbox Code Playgroud)

所以现在当我运行时:

$ pod --version
0.36.1
Run Code Online (Sandbox Code Playgroud)

我被卡住了 :) 为什么我不能有最新的发布版本?也许pod --version指向最新版本cocoapods-core而不是 only cocoapods,所以一切正常,我有正确的版本?

Nik*_*Kov 7

  • 检查您是否使用Gemfile并且指定了cocoapods的版本。
  • 您可以使用特定版本pod *version* action。例如:pod _1.5.0.beta.1_ update或pod _1.5.0.beta.1_ install


Ras*_*kul 5

我跑了pod install,出现了这个错误:

Could not find proper version of cocoapods (1.11.3) in any of the sources
Run Code Online (Sandbox Code Playgroud)

我跑了:

bundle install
Run Code Online (Sandbox Code Playgroud)

之后pod install工作正常


Viv*_*ive 2

我的红宝石版本似乎有些混乱。我仍然不知道是什么以及为什么。我已设法通过此解决方案修复它: https: //stackoverflow.com/a/25021772/849616。之后一切正常。