xcode 如何切换cocoapod版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42293121/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:47:42  来源:igfitidea点击:

How to switch cocoapod version

iosiphonexcodecocoapods

提问by IKKA

My system contain more than cocoapod version(like cocoapods (1.2.0, 1.1.1, 1.0.1, 1.0.0, 0.39.0, 0.38.2)).I want to switch to 0.39.0 version. How to switch to this specified version?

我的系统包含多个 cocoapod 版本(如 cocoapods (1.2.0, 1.1.1, 1.0.1, 1.0.0, 0.39.0, 0.38.2))。我想切换到 0.39.0 版本。如何切换到这个指定的版本?

回答by Ram

first remove the current cocoapod version as

首先删除当前的 cocoapod 版本

sudo gem uninstall cocoapods

and then install the version what you want as

然后安装你想要的版本

sudo gem install cocoapods -v 0.39.0

回答by sebastian friedrich

see this Managing Ruby Tools with Bundler

请参阅使用 Bundler 管理 Ruby 工具

create a ne textfile called Gemfilein the same folder as your project

Gemfile在与项目相同的文件夹中创建一个 ne 文本文件

it contains

它包含了

source 'https://rubygems.org'
gem 'cocoapods', '0.39.0'

you also need to have installed bundler

你还需要安装 bundler

$ gem install bundler

after that enter the following command in your terminal at the project level

之后,在项目级别的终端中输入以下命令

$ bundle install
$ bundle exec pod install

now only the pod version defined in you Gemfile and the pod versions defined in your podfile should be used, not the global ones.

现在只应使用 Gemfile 中定义的 pod 版本和 podfile 中定义的 pod 版本,而不是全局版本。

回答by Dhiru

You can run installcommand by specifying the version of cocoapods . like below .

您可以install通过指定 cocoapods 的版本来运行命令。像下面。

pod _0.38.2_ install 

or

或者

pod _0.39.0_ install

you can also run other command like setupand other just like above .

你也可以setup像上面一样运行其他命令。

I hope this will help you to switch to this specified version of cocopods :)

我希望这会帮助你切换到这个指定版本的 cocopods :)

回答by Oleg Danu

You can specify the version of the Cocoapods you want to use directly after the podcommand: pod _0.39.0_ setup

可以在pod命令后直接指定要使用的 Cocoapods 的版本:pod _0.39.0_ setup

回答by Vikash Kumar

Install specific version with this command example,

使用此命令示例安装特定版本,

sudo gem install cocoapods -v 0.39.0

回答by Brijesh Shiroya

try this:

尝试这个:

sudo gem install cocoapods -v 0.39.0

回答by Giang

Switch 1.7.5 to 1.7.0 :))

将 1.7.5 切换到 1.7.0 :))

Last login: Mon Aug 19 10:24:50 on ttys000
 ~  pod --version
1.7.5
 ~  gem list cocoapods

*** LOCAL GEMS ***

cocoapods (1.7.5, 1.7.0, 1.5.3, 1.1.1)
cocoapods-core (1.8.0.beta.1, 1.7.5, 1.7.0, 1.6.1, 1.5.3, 1.3.1, 1.2.1, 1.1.1)
cocoapods-deintegrate (1.0.4, 1.0.2, 1.0.1)
cocoapods-downloader (1.2.2, 1.1.3, 1.1.2)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.3.1, 1.2.0, 1.1.1)
cocoapods-try (1.1.0)
 ~  gem uninstall cocoapods -v 1.7.5
ERROR:  While executing gem ... (Gem::InstallError)
    cocoapods is not installed in GEM_HOME, try:
    gem uninstall -i /Users/admin/.rvm/gems/ruby-2.3.0@global cocoapods
 ~  sudo gem uninstall cocoapods -v 1.7.5
Password:
Successfully uninstalled cocoapods-1.7.5
 ~  gem list cocoapods

*** LOCAL GEMS ***

cocoapods (1.7.0, 1.5.3, 1.1.1)
cocoapods-core (1.8.0.beta.1, 1.7.5, 1.7.0, 1.6.1, 1.5.3, 1.3.1, 1.2.1, 1.1.1)
cocoapods-deintegrate (1.0.4, 1.0.2, 1.0.1)
cocoapods-downloader (1.2.2, 1.1.3, 1.1.2)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.3.1, 1.2.0, 1.1.1)
cocoapods-try (1.1.0)
 ~  pod --version
1.7.0