flutter 出现“CocoaPods 找不到 pod“Firebase/Database”的兼容版本”错误

问题描述 投票:0回答:6

我遵循了有关如何在我的项目上设置 geofire 的精确指南。我在我的 android 项目上取得了成功..但我无法让它在 ios 上运行..并且当我尝试运行它时出现以下错误。

[!] CocoaPods could not find compatible versions for pod "Firebase/Database":
  In Podfile:
    firebase_database (from `.symlinks/plugins/firebase_database/ios`) was resolved to 6.1.2, which depends on
      Firebase/Database (= 7.11.0)

    flutter_geofire (from `.symlinks/plugins/flutter_geofire/ios`) was resolved to 0.0.1, which depends on
      GeoFire (~> 4.0) was resolved to 4.1.0, which depends on
        Firebase/Database (~> 6.0)

我尝试运行

pod update
,这就是结果

Macbook-MBP:ios Macbook$ pod update
Update all pods
Updating local specs repositories
Analyzing dependencies
firebase_auth: Using Firebase SDK version '7.11.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '7.11.0' defined in 'firebase_core'
firebase_database: Using Firebase SDK version '7.11.0' defined in 'firebase_core'
[!] CocoaPods could not find compatible versions for pod "Firebase/Database":
  In Podfile:
    firebase_database (from `.symlinks/plugins/firebase_database/ios`) was resolved to                             
    6.1.2, which depends on Firebase/Database (= 7.11.0)

    flutter_geofire (from `.symlinks/plugins/flutter_geofire/ios`) was resolved to 0.0.1,
     which depends on
  GeoFire (~> 4.0) was resolved to 4.1.0, which depends on
    Firebase/Database (~> 6.0)

这就是我导入到我的 pubspec.yaml 文件中的内容..

  firebase_database: ^6.1.2
  flutter_geofire: ^2.0.0

我不明白我做错了什么,任何帮助将不胜感激..谢谢

firebase flutter cocoapods geofire
6个回答
2
投票

对于面临此问题的任何人,

  1. 在终端中运行
    flutter clean
  2. 在 podfile 底部添加这一行
    pod 'GeoFire', :git => 'https://github.com/mrdishant/geofire-objc', :tag => '4.3.0'
  3. 不要忘记在 podfile 顶部添加
    use_frameworks!
  4. 从 iOS 中删除 Pod 文件夹。
  5. 将 podfile 上的
    platform :ios, '10.0'
    更改为
    platform :ios, '11.0'
  6. 运行
    pod repo update
    然后
    pod update
  7. 然后在终端中运行
    flutter run

这就是我让它为我工作的方式


1
投票

将 Podfile 中配置的平台更新为

platform :ios, '10.0'
对我来说不起作用。我必须将 iOS 部署目标更新为 10.0 - 位于
Runner > Info > Deployment Target

Xcode iOS Deployment Target

之后,使用

rm -rf Podfile.lock
删除 Podfile.lock,然后运行
pod update
pod install
解决了我的问题。


0
投票

这里同样的问题。我已经尝试修复好几个星期了。网上也查不到任何东西。如果你弄清楚了请留言!抱歉,我还没有足够的“声誉点”来发表评论:(


0
投票

面临同样的挑战,但上述所有解决方案都不适合我。 什么对我有用:

  1. 按照错误中显示的链接(我已突出显示): enter image description here

  2. 在 IDE 中,转到项目文件 -> ios -> .symlinks -> 插件 -> firebase_database -> ios enter image description here

  3. 打开依赖项的.podspec 文件。 enter image description here

  4. 查找:s.ios.deployment_target = '12.0'

  5. 我认为“s.ios.deployment_target”应该小于或等于Podfile中的“platform :ios, 'XX.0'”。 enter image description here

  6. 将 s.ios.deployment_target 值更改为小于平台:ios 中的值后,在 podfile 中,尝试删除 Podfile.lock、pod install --repo-update 等。

  7. 对其他抛出错误的 podfile 执行相同的操作,在您的情况下:flutter_geofire、firebase_database 等。

  8. 您也可以检查此解决方案。 [https://stackoverflow.com/questions/65881232/specs-satisfying-the-firebase-admob-but-they-required-a-higher-minimum-deploy]


0
投票

复制您的文件并将其替换为以下代码。 应该有效。

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

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!
  pod 'GeoFire', :git => 'https://github.com/mrdishant/geofire-objc'

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

0
投票

这对我有用 1 - 颤动清洁 2 - 颤振运行

© www.soinside.com 2019 - 2024. All rights reserved.