【问题标题】:Ejected React Native app cannot reach Firestore backend弹出的 React Native 应用程序无法访问 Firestore 后端
【发布时间】:2020-09-06 17:07:38
【问题描述】:

我在使用 expo 的 react-native 应用程序中通过 Firebase Javascript SDK 使用 Firestore,但在从 expo 弹出后,即使我的设备已连接到互联网,我也会收到此错误:

@firebase/firestore: Firestore (7.19.1): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.

我该如何解决这个问题,还是应该只使用 react-native-firebase 包?

【问题讨论】:

  • 我也有同样的问题。
  • @ColdCerberus 尝试将 firebase.firestore().settings({experimentalForceLongPolling: true}) 添加到您的 firebase config.js

标签: android firebase react-native google-cloud-firestore react-native-android


【解决方案1】:

我可以通过在我的 firebase config.js 底部添加这一行来解决这个问题:

export const firebase = Firebase.initializeApp(firebaseConfig);
firebase.firestore().settings({experimentalForceLongPolling: true}); // add this

现在 firestore 可以按预期工作

【讨论】:

    猜你喜欢
    • 2019-02-07
    • 2018-09-01
    • 2021-09-18
    • 2018-06-29
    • 1970-01-01
    • 1970-01-01
    • 2018-09-10
    • 2021-08-13
    • 2018-04-24
    相关资源
    最近更新 更多