Flutter:CocoaPods 找不到 pod 的兼容版本 "FBSDKCoreKit"

Flutter: CocoaPods could not find compatible versions for pod "FBSDKCoreKit"

我正在构建一个 flutter 应用程序,并且在 flutter 中使用 Facebook 开发日志记录。我使用了 flutter_facebook_login: ^3.0.0flutter_facebook_auth: ^3.3.2 插件,这个插件在 android 中有效,但在 ios 中它给了我以下错误:

[!] CocoaPods could not find compatible versions for pod "FBSDKCoreKit":
  In Podfile:
    flutter_facebook_auth (from `.symlinks/plugins/flutter_facebook_auth/ios`) was resolved to 2.0.0, which depends on
      FBSDKCoreKit (~> 9.1.0)

    flutter_facebook_login (from `.symlinks/plugins/flutter_facebook_login/ios`) was resolved to 0.0.1, which depends on
      FBSDKCoreKit (~> 5.5)

我的flutter doctor -v:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.4, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[!] Xcode - develop for iOS and macOS
    ! Xcode 12.0.0 out of date (12.0.1 is recommended).
      Download the latest version or update via the Mac App Store.
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] Connected device (2 available)

! Doctor found issues in 1 category.
mac@PK-iMac BBT VIIBO % flutter doctor -v)
zsh: parse error near `)'
mac@PK-iMac BBT VIIBO % flutter doctor -v 
[✓] Flutter (Channel stable, 2.0.4, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-GB)
    • Flutter version 2.0.4 at /Users/mac/Development/flutter
    • Framework revision b1395592de (4 weeks ago), 2021-04-01 14:25:01 -0700
    • Engine revision 2dce47073a
    • Dart version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/mac/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0, Build version 12A7209
    ! Xcode 12.0.0 out of date (12.0.1 is recommended).
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] Connected device (2 available)
    • iPhone 11 Pro (mobile) • 47FC0E06-9F40-4F1E-8230-CC914F734D26 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 90.0.4430.93

! Doctor found issues in 1 category.

已经运行pod repo update但无法解决

那我现在该怎么办?

你可以试试这个,

首先清理 Flutter,然后从 ios 文件夹中删除 .symlinks、Pods、Podfile.lock 和 Runner.xcworkspace。

然后 运行 酒吧获得。

告诉我它是否有效。

要解决此问题,请按照以下步骤操作:

  1. flutter clean
  2. 运行 rm -f ios/Podfile.lock(删除ios/Podfile.lock文件)
  3. cd ios 并点击 pod update(更新所有依赖项)
  4. flutter run

如果您使用的是搭载 M1(apple silicon) 的 Macbook,您可以尝试:

arch -x86_64 pod install --repo-update

试试这个

  1. flutter clean

  2. 您可以手动删除 podfile.lock 或在终端中使用此命令 rm -f ios/Podfile.lock

  3. 运行 flutter pub get 不然会出现这个错误

Invalid `Podfile` file: /Users/<YOUR HOME DIRECTORY>/Documents/----/-----/------/---/ios/Flutter/Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first.

  1. 通过项目根目录中的 cd/ios 导航至 /ios 文件夹,然后 pod update

5.flutter run

P.S。确保您的 podfile 具有正确的最低 iOS 部署目标,检查每个 pod 是否可以处理所需的 iOS 版本。

如果你有英特尔芯片

  1. 颤抖干净
  2. 将pubspec.yml文件中的所有依赖项更新为最新版本并执行'get pub'
  3. 转到您的 Podfile 并取消注释 #platform :ios, '9.0' 然后将版本更改为 10 platform :ios, '10.0' 或更高版本
  4. 通过终端转到 ios 文件夹并执行 'pod repo update'
  5. 'pod update' 或 'pod install'

如果你有M1芯片

  1. 颤抖干净
  2. 将pubspec.yml文件中的所有依赖项更新为最新版本并执行'get pub'
  3. 转到您的 Podfile 并取消注释 #platform :ios, '9.0' 然后将版本更改为 10 platform :ios, '10.0' 或更高版本
  4. 通过终端转到 ios 文件夹并执行 'arch -x86_64 pod repo update'
  5. 'arch -x86_64 pod update' 或 'arch -x86_64 pod install'

这有效(Mac 英特尔机器)

我将目标更改为 12.0

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

然后输入pod install