CocoaPods无法找到与“Firebase / CoreOnly”兼容的版本。

186

我已将我的Flutter包更新到最新版本,现在IOS不再工作。

当我尝试更新Pods时,它显示以下错误:

    [!] CocoaPods could not find compatible versions for pod "Firebase/CoreOnly":
    In Podfile:
    cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 0.0.1, which depends on
    Firebase/Firestore (~> 6.0) was resolved to 6.0.0, which depends on
    Firebase/CoreOnly (= 6.0.0)

    cloud_functions (from `.symlinks/plugins/cloud_functions/ios`) was resolved to 0.0.1, which depends on
    Firebase/Functions (~> 5.18) was resolved to 5.18.0, which depends on
    Firebase/CoreOnly (= 5.18.0)

这是我的 pubspec.yaml 文件(与 Firebase 相关):

firebase_core: "^0.4.0"
firebase_auth: "^0.11.0"
firebase_analytics: "^3.0.0"  
cloud_firestore: "^0.11.0+1"
cloud_functions: "^0.3.0"
firebase_storage: "^3.0.0"
firebase_messaging: "^5.0.1"

我已经采取了各种措施来尝试修复:

flutter clean
flutter build ios

pod install
pod update
pod repo update
pod install --repo-update

我在 Podfile 和 Xcode 中将平台设置为 :ios,'12.1',但仍然无法正常工作。

这是我的 Podfile:

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

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

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

def parse_KV_file(file, separator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  pods_ary = []
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) { |line|
      next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
      plugin = line.split(pattern=separator)
      if plugin.length == 2
        podname = plugin[0].strip()
        path = plugin[1].strip()
        podpath = File.expand_path("#{path}", file_abs_path)
        pods_ary.push({:name => podname, :path => podpath});
      else
        puts "Invalid plugin specification: #{line}"
      end
  }
  return pods_ary
end

target 'Runner' do
  use_frameworks!

  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.
  system('rm -rf .symlinks')
  system('mkdir -p .symlinks/plugins')

  # Flutter Pods
  generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
  if generated_xcode_build_settings.empty?
    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
  end
  generated_xcode_build_settings.map { |p|
    if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
      symlink = File.join('.symlinks', 'flutter')
      File.symlink(File.dirname(p[:path]), symlink)
      pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
    end
  }

  # Plugin Pods
  plugin_pods = parse_KV_file('../.flutter-plugins')
  plugin_pods.map { |p|
    symlink = File.join('.symlinks', 'plugins', p[:name])
    File.symlink(p[:path], symlink)
    pod p[:name], :path => File.join(symlink, 'ios')
  }
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

我不熟悉Flutter的yaml文件,但是0.11.0+1看起来很可疑,因为FirebaseFirestore需要Firebase 6.x,而FirebaseFunctions需要Firebase 5.x。 - Paul Beusterien
如果被接受的答案没有帮助,我会在另一个问题下面放置我的答案。https://dev59.com/aFQK5IYBdhLWcg3wJMgm#69047809 - Hesam
33个回答

1
  1. 删除 Podfile 文件
  2. 运行 pod init 命令
  3. 运行 pod install 命令

对我来说有效


1

以下是我亲测有效的方法。

  1. 删除 ios 目录下的 Podfile.lock 文件。
  2. 运行 arch -x86_64 pod install 命令。

1

1

我的Podfile文件中有这一行被注释掉了:platform :ios, '11.0',并且设置为11。我取消了注释并将其更改为14。


1

这个问题真的很烦人。但是我是这样解决的。 1- 首先,我更新了firebase包。

   firebase_core: 1.10.0
   firebase_auth: 3.4.1

2- 我进入了Android Studio终端并输入了它。

cd ios
pod deintegrate
pod repo update

3- 在ios文件夹中,我删除了.symlinks文件夹。

4- 最后,在终端中输入了命令。

pod install

如果仍然失败,请更改步骤1中的Firebase更新,然后重复其他步骤。

0

我需要遵循这个答案并执行两件事情

1- 在我的Podfile中,我将platform :ios, '13.0'切换为platform :ios, '10.0'

2- 我不得不移除整个podfile并重新安装它,但这次对于Firebase / Database pod,我使用了pod 'Firebase/Database', '~> 7.0.0'

现在我的podfile看起来像这样:

platform :ios, '10.0'
install! 'cocoapods', :deterministic_uuids => false

target 'MyApp' do
use_frameworks!

# Pods for MyApp

pod 'Firebase/Database', '~> 7.0.0'

// other pods ...

0

背景

解决方案

  1. 进入ios文件夹,执行cd ios
  2. 运行arch -x86_64 pod repo update。我们使用arch -x86_64来支持Silicon芯片架构。
  3. 升级到最新的Cocoapods版本:sudo gem install cocoapods
  4. 确保你安装了ffi包:sudo arch -x86_64 gem install ffi
  5. 安装你的Flutter应用的iOS包:arch -x86_64 pod install
  6. 完成!运行你的应用程序。

0

返回到 pubspec.yaml 文件,确保 flutter fire 包彼此之间兼容。我的问题是因为 firebase_remote_config 版本略新于 cloud firestore,导致我运行 Pod update 时出现错误。


0

我修复了那个问题。

  1. 我猜你添加了新的Firebase包,然后问题出现了。
  2. 移除最后添加的包
  3. 运行flutter clean
  4. 删除podfile.lock
  5. 确保所有Firebase包使用更新的版本
  6. 运行flutter pub get
  7. 进入cd ios/
  8. 运行pod install
  9. 然后就修复好了。

0

对我来说,这是一个简单的解决方案,因为我使用了 Firebase 的旧版本依赖项。所以升级所有依赖项,然后使用 flutter pub get 和 flutter run 对我有效。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接