繁体   English   中英

弹出的 React Native 应用程序无法访问 Firestore 后端

[英]Ejected React Native app cannot reach Firestore backend

我在使用 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 包?

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

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

现在 firestore 对我来说按预期工作

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM