如何使用特定版本的CocoaPods

时间:2022-09-06 12:05:13

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

2 个解决方案

#1


33  

Since CocoaPods is installed through RubyGems you can use their mechanisms for doing this. As outlined here you 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 highly advise 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以适应新版本。如果我们碰到最低版本号,您的旧版本可能会随时停止工作。

#2


2  

the ultimate solution:

最终解决方案:

  1. run a bash script to completely uninstall your current verison (Optinal)

    运行bash脚本以完全卸载当前的verison(Optinal)

    for i in $( gem list --local --no-version | grep cocoapods  ); do
        sudo gem uninstall $i;
    done   
    sudo gem uninstall xcodeproj
    
  2. install a specific verison of CocoaPod

    安装CocoaPod的特定版本

    gem install cocoapods -v 0.39.0
    

#1


33  

Since CocoaPods is installed through RubyGems you can use their mechanisms for doing this. As outlined here you 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 highly advise 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以适应新版本。如果我们碰到最低版本号,您的旧版本可能会随时停止工作。

#2


2  

the ultimate solution:

最终解决方案:

  1. run a bash script to completely uninstall your current verison (Optinal)

    运行bash脚本以完全卸载当前的verison(Optinal)

    for i in $( gem list --local --no-version | grep cocoapods  ); do
        sudo gem uninstall $i;
    done   
    sudo gem uninstall xcodeproj
    
  2. install a specific verison of CocoaPod

    安装CocoaPod的特定版本

    gem install cocoapods -v 0.39.0