ios 如何使用特定版本的 CocoaPods
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29406298/
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
How to use a specific version of CocoaPods
提问by vondip
Is it possible to somehow specific the version of CocoaPods I'd like to use when upgrading or installing a Podfile? I've encountered several times where Podfiles work correctly with one version of CocoaPods but not with others.
在升级或安装 Podfile 时,是否可以以某种方式指定我想要使用的 CocoaPods 版本?我曾多次遇到 Podfiles 在一个版本的 CocoaPods 上正常工作但在其他版本上不能正常工作的情况。
For example, the syntax I'm looking for is like the following:
例如,我正在寻找的语法如下所示:
pod -v 0.34 install
回答by Keith Smiley
Since CocoaPods is installed through RubyGems you can use their mechanisms for doing this. As outlined hereyou can do this:
由于 CocoaPods 是通过 RubyGems 安装的,因此您可以使用它们的机制来执行此操作。如此处所述,您可以执行以下操作:
pod _0.34.0_ install
You can verify this is working with:
您可以验证这是否适用于:
pod _0.34.0_ --version
Also I would highlyadvise against doing this at all. I would definitely recommend you keep CocoaPods up to date and change your Podfile as needed to adapt to new versions. At anytime your old version could stop working as expected if we bump the minimum version number.
我也强烈建议不要这样做。我绝对会建议您保持 CocoaPods 最新,并根据需要更改 Podfile 以适应新版本。如果我们提高最低版本号,您的旧版本随时可能会按预期停止工作。
回答by Jeff Wang
the ultimate solution:
最终解决方案:
run a bash script to completely uninstall your current verison (Optinal)
for i in $( gem list --local --no-version | grep cocoapods ); do sudo gem uninstall $i; done sudo gem uninstall xcodeproj
install a specific verison of CocoaPod
gem install cocoapods -v 0.39.0
运行 bash 脚本以完全卸载您当前的版本(可选)
for i in $( gem list --local --no-version | grep cocoapods ); do sudo gem uninstall $i; done sudo gem uninstall xcodeproj
安装特定版本的 CocoaPod
gem install cocoapods -v 0.39.0