在 React Native 的 App Messaging 中安装 Firebase 时出错

Error Installing Firebase In App Messaging in React Native

我正在尝试在我的应用中安装 Firebase In-App Messaging 组件 我之前已经安装了现有的 firebase 组件,下面是我的 package.json 在安装应用程序内消息传递之前的 firebase 内容。

    "@react-native-firebase/analytics": "^6.7.1",
    "@react-native-firebase/app": "^6.7.1",
    "@react-native-firebase/crashlytics": "^6.7.1",
    "@react-native-firebase/dynamic-links": "^6.7.1",
    "@react-native-firebase/messaging": "^6.7.1",

所以我决定

npm install --save @react-native-firebase/in-app-messaging@^6.7.1

当我尝试 pod install 时出现以下错误:

CocoaPods could not find compatible versions for pod "GoogleDataTransportCCTSupport":
  In snapshot (Podfile.lock):
    GoogleDataTransportCCTSupport (= 3.0.0, ~> 3.0)

  In Podfile:
    RNFBInAppMessaging (from `../node_modules/@react-native-firebase/in-app-messaging`) was resolved to 6.7.1, which depends on
      Firebase/InAppMessaging (~> 6.13.0) was resolved to 6.13.0, which depends on
        FirebaseInAppMessaging (~> 0.15.5) was resolved to 0.15.6, which depends on
          GoogleDataTransportCCTSupport (~> 1.0)

    RNFBMessaging (from `../node_modules/@react-native-firebase/messaging`) was resolved to 6.7.1, which depends on
      Firebase/Messaging (~> 6.13.0) was resolved to 6.13.0, which depends on
        FirebaseMessaging (~> 4.1.9) was resolved to 4.1.10, which depends on
          FirebaseCore (~> 6.2) was resolved to 6.4.0, which depends on
            FirebaseCoreDiagnostics (~> 1.0) was resolved to 1.2.4, which depends on
              GoogleDataTransportCCTSupport (~> 3.0)

我在这里遗漏了什么吗?

CocoaPods 的副本无法找到 pod“GoogleDataTransportCCTSupport”的兼容版本

发生这种情况是因为您显然正在使用已弃用的 firebase 5.x.x。简而言之 shell 您需要解决上述问题中推荐的解决方法。

或者您可以升级到 firebase 6.x.x

看来您的播客文件中可能存在冲突。删除您的播客文件和 运行 pod install --repo-update 可能会有所帮助。还要确保您没有旧版本遗留的任何 firebase pods(请参阅 here)。

  1. 更新椰子 (https://guides.cocoapods.org/using/getting-started.html)
  2. 删除 pod 锁定文件
  3. pod install