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

查看:72
本文介绍了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,所有Google,找不到任何解决方案. 我所看到的其他应用程序,例如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;
        });
       }
    });
}

希望他们能为您打招呼.

I hope they serve you greetings.

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

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