通过推送通知打开时混合应用程序休眠

Hybrid app hybernated when opened via push notification

我有我的 iOS angular/capacitor 应用程序,它能够通过电容器事件接收和管理推送通知:

// Method called when tapping on a notification
PushNotifications.addListener('pushNotificationActionPerformed',
  async (action: ActionPerformed) => {
      await this.router.navigateByUrl('url/to/go')
      console.log('logic done);
  }
);

点击后发生的事情绝对是单一的:日志确认我的操作已完成,但在我点击 UI 的任何部分之前,在我的应用程序中没有任何反应。然后路线正确更新到目的地。 在 iPhone 6 iOS 12.5

中测试

怎么会这样?

我自己找到了解决方案:出于某种原因?无法解释我需要将路由器语句包装在 ngZone 服务中:

this.ngZone.run(() => this.router.navigateByUrl(路径));

如果有人能解释这些,我将不胜感激:)