Cocoapods points to wrong version

时间:2015-10-06 08:57:24

标签: ruby gem cocoapods

I had some problems with one version of the project. I've found this answer where someone suggest steps to remove all cocoapods-connected stuff from the machine and reinstall it. I did follow the steps:

$ '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

The problem is that when i again grep all cocoapods, the list was equal to upper one, nothing disappeared.

$ 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.

But why does it want me to install 0.36.1? Anyway, as it asked, I did:

$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

So now when I run:

$ pod --version
0.36.1

And I'm stuck :) Why can't I have newest release version? Maybe pod --version points to the newest version of cocoapods-core instead of only cocoapods, so everything is ok and I have the correct version?

4 个答案:

答案 0 :(得分:1)

在我的ruby版本中似乎搞砸了。我仍然不知道为什么和为什么。我已设法通过此解决方案修复它:https://stackoverflow.com/a/25021772/849616。一切正常后。

答案 1 :(得分:1)

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

答案 2 :(得分:0)

对于任何试图更新可可豆的人。完成上述所有操作后,我无法解决此问题。然后,我前往已解决的答案,并且不愿意删除RVM,因此尝试以另一种方式解决此问题。

我发现我的问题确实在我的Gemfile中。

首先,运行 gem install cocoapods,以确保您具有最新版本,或要下载的任何指定版本。

第二,确保您的项目Gemfile没有指定cocoapods版本号,而只是将其指定为: gem "cocoapods" 如果不是,请进行更改,然后运行bundle update以重新生成Gemfile.lock文件,您的问题应得到解决。如果不是,请继续删除Gemfile.lock文件,然后运行bundle update。您可以通过打开Gemfile.lock文件并搜索cocoapods-core <version number here>

来轻松查看要加载哪个gem版本。

此时,您可以进入您的项目并运行 pod setup 然后检查cocoapods版本 pod --version

现在终于可以自由运行了 pod install 替换Podfile.lock文件,回到快乐的开发生活。希望能对某人有所帮助,并使他们免于辛苦工作。

答案 3 :(得分:0)

当它迁移到更高的Swift版本时,您可能会遇到此问题。假设您已经安装了可可足类,则可能需要运行 bundle update 命令(可能使用sudo)。

有关更多详细信息,您可以检查:https://guides.cocoapods.org/using/a-gemfile.html

此外,我建议您执行以下操作:

  • 安装最新的Xcode版本。
  • 清除项目中的派生数据(不仅仅是干净的项目)。
  • 运行pod update命令。