簡體   English   中英

CocoaPods 找不到 pod“Firebase/CoreOnly”的兼容版本

[英]CocoaPods could not find compatible versions for pod "Firebase/CoreOnly"

我已經將我的 flutter 包更新到最新版本,現在 IOS 不再工作了。

當我嘗試更新 pod 時,它顯示此錯誤:

    [!] 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 中將 platform:ios, '12.1' 設置為構建目標,但沒有恢復正常。

這是我的播客文件:

# 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

嘗試調用pod repo update

如果問題沒有解決

刪除根目錄下的 Podfile.lock,然后運行pod install

編輯 podfile 中的最低 ios 版本,然后運行 ​​pod install。

platform :ios, '9.0'更改為platform :ios, '10.0'然后運行pod install為我修復了它。

🌟 對於 M1 Mac 用戶 

  1. 轉到項目中的ios/Pods/Local Podspecs目錄
  2. 檢查每個json文件以找到所需的最高 iOS 版本。 我的是"ios": "10.0"
  3. 回到ios/ directory
  4. 打開Podfile文件
  5. 取消注釋# platform :ios, '9.0'並將9.0替換為步驟 2 中的版本。 - 例如10.0

然后是 M1 的特定部分

  1. 運行sudo arch -x86_64 gem install ffi

  2. 運行arch -x86_64 pod repo update

  3. 運行arch -x86_64 pod install錯誤應該消失了



  1. 如果使用 Flutter cd -回到你的根目錄 - 打開 iOS Simulator 並運行flutter run



10. 享受吧!🌟 



如果不工作,您可能需要運行flutter pub add firebase_core firebase_core 以將 firebase_core 添加到您的pubspec.yaml文件 在第 1 步之前




如果仍然無法正常工作,請嘗試以下獎勵步驟:

  • 試圖直接從 Xcode 運行? 首先在你的 Flutter 項目中運行flutter build iOS -> 然后在 Xcode 中運行

  • 仍然不工作cd iOS run rm -rf Pods/ Podfile.lock ; pod install rm -rf Pods/ Podfile.lock ; pod install

  • 還是行不通 ? 在 Spotlight 中搜索 Keychain Access -> 打開 -> 右鍵單擊​​登錄 -> 解鎖(構建成功后將重新鎖定)

  • 還是行不通 ? Xcode Runner 信息截圖 確保您的 Runner Info Configs 看起來像這樣



希望這可以幫助 ! 如果仍然遇到問題,請在下方評論!

只需執行pod update然后pod install 這對我有用。

  1. 執行flutter clean

  2. 轉到ios/文件夾,編輯Podfile並選擇要啟動的平台和版本。 例如對於平台ios和版本12.0

播客文件

# Uncomment this line to define a global platform for your project
platform :ios, '12.0'
  1. 執行pod update

  2. 執行pod install (下載依賴可能需要幾分鍾)

  3. 執行flutter run

在此處輸入圖像描述

要使用版本 ^1.0.3 的“firebase_core”依賴項,“iOS 部署目標”必須不小於“10.0”

您只需要更新 pod repo 您的 cocopods 存儲庫可能已過期

按照此命令更新您的 pod

  1. flutter clean
  2. pod repo update
  3. 刪除了/ios/Pods//ios/Podfile.lock
  4. 運行pod install

如果您使用的是 M1 mac。

通過運行刪除 podfile.lock

arch -x86_64 rm -rf Podfile.lock

然后通過運行更新 pod

arch -x86_64 pod install --repo-update

對於 M1 Mac ,移動到文件夾 ios:

cd ios

方法一:

打開你的終端並運行

sudo gem uninstall cocoapods
sudo gem install cocoapods

重新啟動 IDE 或編輯器

方法二:

注意:僅在方法 1不起作用時嘗試

現在是時候為M1 Mac安裝 pod 了:

 sudo arch -x86_64 gem install ffi
 arch -x86_64 pod repo update
 arch -x86_64 pod install

現在99%的更改安裝錯誤應該消失了

現在只有 1% 的機會仍然會出錯:

打開您的 ios Runner XCode 項目並按照圖像說明進行操作。

從 Architectures for Target 更改您的排除架構

form i386 to arm64 i386 (Note: space is important)

在此處輸入圖像描述

現在回到你的根目錄並運行

 flutter run

另外,重新啟動您的編輯器。

我在嘗試將 Firebase Analytics 添加到我的項目時遇到了同樣的問題。 我一直在終端中運行 pod update,但在確保 pubspec.yaml 文件中的所有顫振包都在最新版本上之前,我無法成功訪問 FirebaseCore (6.0.0)。

1)我擺脫了導致錯誤的包。 對我來說,它是 Firebase Analytics,因為我剛剛將它添加到我的項目中。

2) 我瀏覽了所有的 firebase 包,並確保我的 pubspec.yaml 中有最新版本。 他們來了:

firebase_core: ^0.4.0
firebase_database: ^3.0.0
firebase_auth: ^0.11.0
firebase_storage: ^3.0.0

3) 導航到 ios 文件夾並運行 pod update

4) 將 Firebase Analytics 包(或您有興趣添加的任何內容)添加到 pubspec.yaml。

5)運行包獲取

6) 在終端運行 pod install

簡單的解決方案對我有用(由 IDE 本身建議)

pod install --repo-update

在終端 IOs 文件夾中運行命令

2021 年 3 月

cloud_firestore: ^1.0.0

cd ios
rm Podfile.lock
pod repo update

在反應原生

cd ios

rm -rf Podfile.lock

pod install

當我從 Podfile 平台中的符號鏈接/插件添加最高 ios 版本依賴項時為我工作:ios,'11.0'

返回ios文件夾並打開 Podfile,然后將平台更改為以下platform :ios, '10.0' 之后單擊編輯器中的run按鈕。

截至 2021 年 4 月 28 日,對我有用的方法(經過幾天的奮斗):

在 AppDelegate.swift (flutter-project/ios/Runner) 中,添加這兩行:

FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)

在終端:

pod repo update 

flutter build ios

然后在 Xcode 中運行您的項目。

pod update然后pod install 這對我有用

對我來說這有效

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

首先從您的 ios 文件夾中刪除 podfile.lock 文件

然后從終端轉到您的 ios 文件夾

cd ios

現在輸入終端

pod repo update
pod install

要么

pod install
pod repo update

這個 react-native-firebase 遷移指南可能對您的情況有用:

https://rnfirebase.io/migrating-to-v6#removing-v5-from-javascript

我卸載了第 5 版並安裝了第 6 版,但似乎需要做一些額外的工作才能擺脫舊版本的 firebase。

  1. 刪除 Podfile
  2. 吊艙初始化
  3. 吊艙安裝

為我工作

這個問題太煩人了。 但這就是我解決它的方法。 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 更新並重復其他步驟。

問題出在 cloud_functions 插件中。 他們有 5.18 版本的 Firebase。 要修復它,您必須手動更改插件 ios 文件夾中的文件 cloud_functions.podspec,而它們最終沒有修復。

更改

s.dependency 'Firebase/Firestore', '~> 5.18'

s.dependency 'Firebase/Firestore', '~> 6.0'

在那之后仍然存在關於 Firebase 函數文件的一些缺失依賴項的錯誤。

我直接在 pod 中添加這一行:

pod 'Firebase/函數'

我知道這一切都是一種解決方法,但對我來說是這樣的。

我必須按照這個答案做兩件事

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 ...

我解決了這個問題。

  1. 我猜你添加了新的 firebase 包,然后出現問題。
  2. 刪除最后添加的包
  3. 跑干凈
  4. 刪除 podfile.lock
  5. 確保所有 firebase 軟件包都使用更新版本
  6. 運行 flutter pub get
  7. 去 cd ios/
  8. 運行 pod install 然后修復。

這對我有用。

  1. 刪除ios目錄下的Podfile.lock
  2. 運行 arch -x86_64 pod install 后

Go 返回 pubspec.yaml 並確保 flutter 防火包都兼容在一起。 我的問題是因為 firebase_remote_config 版本比雲 Firestore 稍新,並且在我運行 Pod 更新時連續導致錯誤。

對我有用的簡單解決方案,這是因為我使用的是舊版本的 Firebase 依賴項。 所以升級所有依賴項然后使用 flutter pub get 和 flutter run 對我有用

我的 podfile 將此行注釋為platform:ios, '11.0'並設置為 11 我取消注釋並更改為 14

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM