【问题标题】:Error when running pod install运行 pod install 时出错
【发布时间】:2017-03-26 05:49:58
【问题描述】:

当我运行pod install 命令时,我收到以下错误:

[!] The `master` repo requires CocoaPods 1.0.0 -  (currently using 0.39.0)
Update Cocoapods, or checkout the appropriate tag in the repo.

目前对我来说更新不是一个选项。

我查看了the answers to this question,但似乎没有一个解决方案适合我。

如何继续使用 CocoaPods 0.39.0 进行依赖管理?

【问题讨论】:

  • 更新 cocoapods 有什么问题?

标签: cocoapods


【解决方案1】:

Cocoapods 在 3 月份遇到了速率限制问题,并实施了分片以避免将来出现此问题。有一篇关于它的博文here

要解决此问题,您可以更新到 1.x 版本的 Cocoapods 或将新源添加到 Podfile 的顶部:

source "https://github.com/CocoaPods/Old-Specs"

您可能需要替换另一个源代码行。


如果您仍然遇到问题,可能是因为特定 pod 在您现在使用的源中没有可访问的规范。我在Apptentive SDK 遇到了这个问题。您可以在 Podfile 中指定单个库的来源,如下所示:

pod 'apptentive-ios', :git => 'https://github.com/apptentive/apptentive-ios.git', :tag => 'v3.0.0'

只需使用正确的值更新 :git:tag

对于 Github 项目,最简单的方法可能是通过您正在查看的任何库的 Releases 页面找到您想要的特定版本的标签。

【讨论】:

  • 你能回答一步一步在终端做什么
【解决方案2】:

在终端中编写以下命令

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

【讨论】:

  • 此命令安装最新版本的 CocoaPods。这没有意义,OP 说“我目前无法选择更新”
【解决方案3】:

首先在 Podfile 中将 source "https://github.com/CocoaPods/Specs" 替换为 "source "https://github.com/CocoaPods/Old-Specs"

通过以下命令移动到您的工作区根文件夹:

cd <path to your workspace>

Pod install

如果效果不佳,请按照以下步骤尝试以上步骤。

在终端中按照以下步骤操作:

gem list --local | grep cocoapods

你会看到类似这样的输出:

cocoapods (0.27.1, 0.20.2)
cocoapods-core (0.27.1, 0.20.2)
cocoapods-downloader (0.2.0, 0.1.2)

现在为了更安全,请使用以下命令删除所有本地 pod:

sudo gem uninstall cocoapods
sudo gem uninstall cocoapods-core
sudo gem uninstall cocoapods-downloader

更安全的一面删除可可豆荚版本 0.39.0

sudo gem uninstall cocoapods -v 0.39.0

重新安装 cocoa pods 0.39.0 版

sudo gem install cocoapods -v 0.39.0

然后在终端中运行以下命令:

cd <path to your workspace>
pod install (this time it would fail again, but that's fine)
cd ~/.cocoapods/repos
git clone https://github.com/CocoaPods/Specs.git
cd specs
git checkout v0.32.1

通过以下命令移动到您的工作区根文件夹:

cd <path to your workspace>

运行以下命令:

rm -rf Pods
rm -rf Podfile.lock
pod install (this time you should be able to see it working)

【讨论】:

    【解决方案4】:

    您好,我尝试了所有答案,但没有任何效果,最后我在终端中尝试了这些步骤。

    1- Open Terminal
    2- cd < Your Project File Location>
    3- sudo gem install cocoapods --pre
    4- pod setup
    5- touch podfile
    6- pod install
    

    【讨论】:

      【解决方案5】:
      note: Using new build system
      note: Building targets in parallel
      note: Planning build
      note: Constructing build description
      

      无法为模拟器构建应用程序。 在 iPhone 11 Pro 上启动应用程序时出错。

      如果出现此错误

      在您的 podfile 中添加以下代码

      post_install 做 |installer| installer.pods_project.targets.each 做 |target| flutter_additional_ios_build_settings(目标) target.build_configurations.each 做 |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' 结尾 结尾 结束

      Then Also Change Deployment Target to 9.0 in

      (你的项目)> ios > Flutter > Flutter.podsec

      终于成功了

      【讨论】:

        猜你喜欢
        • 2017-11-30
        • 2022-08-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-07-04
        • 2020-08-13
        • 2020-10-30
        • 1970-01-01
        相关资源
        最近更新 更多