【问题标题】:Cocoapods error after installing "firebase_firestore" Flutter plugin [duplicate]安装“firebase_firestore”Flutter插件后Cocoapods错误[重复]
【发布时间】:2018-03-24 21:12:38
【问题描述】:

我的应用与 Firebase RTDB 一起工作,但想尝试使用 Firestore,所以我按照说明安装了“firebase_firestore”插件。

当我现在运行我的应用程序时,我收到以下错误:

 Resolving dependencies of `Podfile`
    [!] Unable to satisfy the following requirements:

    - `Firebase/Firestore` required by `firebase_firestore (0.0.1)`

    Specs satisfying the `Firebase/Firestore` dependency were found, but they required a higher minimum deployment target.

我尝试在我的 Podfile 中指定 platform :ios, '9.0'10.0,但这并没有任何区别。所有其他 pod 都可以正常安装。

这是整个 Cocoapods 运行日志:https://pastebin.com/raw/SBz8Bqgf

我的 Podfile 看起来像这样(标准 Flutter Podfile):

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

if ENV['FLUTTER_FRAMEWORK_DIR'] == nil
  abort('Please set FLUTTER_FRAMEWORK_DIR to the directory containing Flutter.framework')
end

target 'Runner' do
  # Pods for Runner

  # Flutter Pods
  pod 'Flutter', :path => ENV['FLUTTER_FRAMEWORK_DIR']

  if File.exists? '../.flutter-plugins'
    flutter_root = File.expand_path('..')
    File.foreach('../.flutter-plugins') { |line|
      plugin = line.split(pattern='=')
      if plugin.length == 2
        name = plugin[0].strip()
        path = plugin[1].strip()
        resolved_path = File.expand_path("#{path}/ios", flutter_root)
        pod name, :path => resolved_path
      else
        puts "Invalid plugin specification: #{line}"
      end
    }
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

这是 Podfile.lock 的链接,也许这更有趣。我看到它没有用 Firestore 更新,大概是因为运行失败:https://pastebin.com/raw/hj2jHE76

【问题讨论】:

  • 请更新您的问题以包含来自您的Podfile 的代码。
  • 嗨@JenPerson - 我添加了 Podfile + Cocoapods 运行的日志。 Podfile 是 AFAIK 标准的 Flutter Podfile,不记得对其进行过更改(尝试指定平台版本除外)

标签: firebase cocoapods google-cloud-firestore flutter


【解决方案1】:

万一其他人偶然发现了这个问题,我只是想扩展 V. Roussel 的答案(我将其标记为正确答案),因为 Flutter 有点抽象出这个 Cocoapods 过程。这是我为能够运行“pod repo / update”所做的:

  1. 运行pod repo update
  2. 将环境变量FLUTTER_FRAMEWORK_DIR 设置为类似于/Users/youruser/bin/flutter/bin/cache/artifacts/engine/ios/ 的内容。您可以通过locate Flutter.podspec 找到此目录
  3. YourFlutterProject/ios 运行pod update

在此之后,您应该能够再次运行您的应用程序。

【讨论】:

    【解决方案2】:

    cloud_firestore 现在已经升级到 0.03,这应该允许您运行 POD。

    在 pubspec.yaml 中 cloud_firestore: "^0.0.3"

    如果这从一开始就不起作用,请将 Firebase 核心添加到您的 podfile 并运行 pod install。

    注意:据我所知,您还不能将 Firestore 与 Firebase auth 或 Firebase 分析等其他模块结合使用。

    【讨论】:

    • 嗨,请在最后参考您的注释 - 结合 Firestore 和其他(Auth/Firebase RTDB 等)直到最近都运行良好 - 这是由引用不同版本的各种 Flutter 包引起的回归底层 Firebase 软件包。此处跟踪此问题:github.com/flutter/flutter/issues/12945
    • 嘿比约恩,我确实做到了。我实际上在那里发布了问题github.com/flutter/flutter/issues/13341,它解决了问题12945,因为我无法让它工作。现在我不希望将我的项目直接附加到 GIT 绳索上,也不希望它成为示例集的一部分。我猜我只需要等到修复程序在常规 Aplha 集中普遍可用。感谢您指出这一点。
    猜你喜欢
    • 1970-01-01
    • 2021-04-13
    • 1970-01-01
    • 2019-09-01
    • 2016-05-11
    • 2021-01-16
    • 2021-06-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多