Ionic 4 IOS FIRESTORE 内部断言失败:AsyncQueue 已经失败:在索引数据库服务器中遇到内部错误 [英] Ionic 4 IOS FIRESTORE INTERNAL ASSERTION FAILED: AsyncQueue is already failed: An internal error was encountered in the Indexed Database server

查看:18
本文介绍了Ionic 4 IOS FIRESTORE 内部断言失败:AsyncQueue 已经失败:在索引数据库服务器中遇到内部错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 Ionic 应用程序,我使用 Firestore 作为数据库,使用离线模式.

I am developing an Ionic application, I am using Firestore as a database, using offline mode.

import {AngularFirestoreModule} from '@ angular / fire / Firestore';
AngularFirestoreModule.enablePersistence (),

当我打开应用程序时,一切都运行良好,即使在离线模式下也是如此.但是,如果应用程序在重新打开时以后台模式保持打开状态,它总是会提示此错误:

When I open the application everything works very well, even on offline mode. However, if the application stays open in the background mode on re-opening it always tells this error:

FIRESTORE (6.2.4) 内部断言失败:AsyncQueue 已经失败:索引数据库中遇到内部错误服务器.

FIRESTORE (6.2.4) INTERNAL ASSERTION FAILED: AsyncQueue is already failed: An internal error was encountered in the Indexed Database server.

而且我无法再在应用程序中的任何地方导航,因为我的条件是订阅一直有效,直到组件被销毁(这发生在我更改页面时)

And I can no longer navigate anywhere in the application because I have the condition that the subscription is alive until the component is destroyed (that happens when I change the page)

takeUntil (componentDestroyed (this)):

我收到以下错误:

"取消订阅期间发生 1 个错误:1) 错误:FIRESTORE (6.2.4)内部断言失败:AsyncQueue 已经失败:一个内部在索引数据库服务器中遇到错误"

"1 errors occurred during unsubscription: 1) Error: FIRESTORE (6.2.4) INTERNAL ASSERTION FAILED: AsyncQueue is already failed: An internal error was encountered in the Indexed Database server"

并且整个应用程序停止工作,不得不关闭并重新打开它非常烦人.

And the full application stops working and it is very annoying to have to close it and reopen.

有什么不同的做法吗?我已经看过 StackOverflow、Github 和所有谷歌,但找不到任何解决方案.我所看到的其他应用程序(如 Netflix、HBO 等)所做的.是当您重新打开应用程序时,它并没有准确地从它停留的位置开始,它会警告您它正在​​加载,并且当它完成加载时,它会让您非常接近离开应用程序而没有活动之前的位置.我想它有一个背景和前景变化检测器以及每个事件的函数.

Is there any different way of doing? I already looked at StackOverflow, Github, all google and I can't find any solution. What I have seen the other applications like Netflix, HBO, etc. do. is that when you reopen the application does not start exactly where it stayed, it warns you that it is loading, and when it finishes loading it leaves you very close to where you were before leaving the application without activity. I imagine it has a background and foreground change detector and a function for each event.

我想通过离子循环我可以解决这个问题,比如:- 检测对后台的更改,如果前台有任何更改,请取消订阅并重新订阅.

I was thinking that with ionic cycles I could solve that problem, like: -detect the change to the background and unsubscribe and re-subscribe if any change to the foreground.

你知道其他方式吗?

推荐答案

我解决的那个错误:

    window.onerror = function(error) {
  if (error.indexOf("An internal error was encountered in the Indexed Database server") >= 0) {
    // Refresh the page to restore IndexedDb to a working state.
    window.location.reload();
  }
};

以及如何观察背景和前景的状态变化:

and about how to observe the state changes of background and foreground:

import { Platform } from 'ionic-angular';

@Component({
  template: `OK`
})

constructor(public platform: Platform) {

    platform.ready().then(() => {

      if (platform.is('cordova')){

        //Subscribe on pause
        this.platform.pause.subscribe(() => {
          //Hello pause
        });

        //Subscribe on resume
        this.platform.resume.subscribe(() => {
          window['paused'] = 0;
        });
       }
    });
}

我希望他们为您服务.

这篇关于Ionic 4 IOS FIRESTORE 内部断言失败:AsyncQueue 已经失败:在索引数据库服务器中遇到内部错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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