如何清除 Firestore 持久性数据? [英] How to clear Firestore persistence data?

查看:21
本文介绍了如何清除 Firestore 持久性数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 iOS 应用的 Firestore 缓存似乎与 Firestore 不同步.结果我不得不禁用持久性.有没有办法重置缓存?有没有办法确保它始终保持同步?我所做的只是从数据库中删除文档!

My iOS app's firestore cache seems to have got out of sync with Firestore. As a result I've had to disable persistence. Is there anyway to reset the cache? And is there a way to make sure it's constantly in sync? All I did was delete documents from the database!

推荐答案

API 中现在有一个用于清除持久性的功能.除了测试,不推荐用于任何其他用途,但您可以使用

There is now a feature in the API for clearing persistence. It is not recommended for anything but tests, but you can use

firebase.firestore().clearPersistence().catch(error => {
  console.error('Could not enable persistence:', error.code);
})

它必须在使用 Firestore 数据库之前运行.

It must run before the Firestore database is used.

这篇关于如何清除 Firestore 持久性数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆