ios 如何降级或安装旧版本的 Cocoapods

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20487849/
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-08-30 22:42:54  来源:igfitidea点击:

How to downgrade or install an older version of Cocoapods

ioscocoapods

提问by a fair player

How can I downgrade Cocoapods to an older version, or how can I install an older version of Cocoapods?

如何将 Cocoapods 降级到旧版本,或者如何安装旧版本的 Cocoapods?

回答by NSMutableString

to remove your current version you could just run:

要删除您当前的版本,您可以运行:

sudo gem uninstall cocoapods

you can install a specific version of cocoa pods via the following command:

您可以通过以下命令安装特定版本的可可豆荚:

sudo gem install cocoapods -v 0.25.0

You can use older installed versions with following command:

您可以使用以下命令使用较旧的安装版本:

pod _0.25.0_ setup

回答by Augard

Actually, you don't need to downgrade – if you need to use older version in some projects, just specify the version that you need to use after podcommand.

实际上,你不需要降级——如果你需要在某些项目中使用旧版本,只需在pod命令后指定你需要使用的版本。

pod _0.37.2_ setup

回答by Ori

If you need to install an older version (for example 0.25):

如果您需要安装旧版本(例如 0.25):

pod _0.25.0_ install

回答by neoneye

PROMPT> gem uninstall cocoapods

Select gem to uninstall:
 1. cocoapods-0.32.1
 2. cocoapods-0.33.1
 3. cocoapods-0.36.0.beta.2
 4. cocoapods-0.38.2
 5. cocoapods-0.39.0
 6. cocoapods-1.0.0
 7. All versions
> 6
Successfully uninstalled cocoapods-1.0.0
PROMPT> gem install cocoapods -v 0.39.0
Successfully installed cocoapods-0.39.0
Parsing documentation for cocoapods-0.39.0
Done installing documentation for cocoapods after 1 seconds
1 gem installed
PROMPT> pod --version
0.39.0
PROMPT>

回答by Honey

Several notes:

几个注意事项:

Make sure you first get a list of all installed versions. I actually had the version I wanted to downgrade to already installed, but ended up uninstalling that as well. To see the list of all your versions do:

确保您首先获得所有已安装版本的列表。我实际上已经安装了我想要降级的版本,但最终也卸载了它。要查看所有版本的列表,请执行以下操作:

sudo gem list cocoapods

Then when you want to delete a version, specify that version.

然后,当您要删除某个版本时,请指定该版本。

sudo gem uninstall cocoapods -v 1.6.2

You could remove the version specifier -v 1.6.2and that would delete all versions:

您可以删除版本说明符-v 1.6.2,这将删除所有版本:

You may try all this and still see that the pod you expected is still installed. If that's the case then it might be because the pod is stored in a different directory.

您可以尝试所有这些,仍然会看到您期望的 pod 仍然安装。如果是这种情况,则可能是因为 pod 存储在不同的目录中

sudo gem uninstall -n /usr/local/bin cocoapods -v 1.6.2

Then you will have to also install it in a different directory, otherwise you may get an error saying You don't have write permissions for the /usr/bin directory

然后您还必须将其安装在不同的目录中,否则您可能会收到错误消息,提示您没有对 /usr/bin 目录的写权限

sudo gem install -n /usr/local/bin cocoapods -v 1.6.1

To check which version is your default do:

要检查哪个版本是您的默认版本,请执行以下操作:

pod --version

For more on the directory problem see here

有关目录问题的更多信息,请参见此处

回答by Vlad

Note that your pod specs will remain, and are located at ~/.cocoapods/ . This directory may also need to be removed if you want a completely fresh install.

请注意,您的 pod 规格将保留,并位于 ~/.cocoapods/ 。如果您想要全新安装,也可能需要删除此目录。

They can be removed using pod spec remove SPEC_NAMEthen pod setup

可以使用pod spec remove SPEC_NAMEthen删除它们pod setup

It may help to do pod spec remove masterthen pod setup

它可以帮助做的pod spec remove master,然后pod setup