在iOS中打开通知后,onesignal警报通知强制关闭

时间:2019-06-20 12:00:45

标签: ios angular ionic3 onesignal

notification center打开通知后,该应用程序仅运行启动屏幕,并在启动屏幕后强制关闭。我在android中的应用程序是正常打开的the alert。我的ios版本12.2。我的代码在这里:

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

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

        this.oneSignal.startInit('xxxxxxxxxxxxxxxxxxx', 'xxxxxxxxxxx');
        this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.Notification);
        this.oneSignal.handleNotificationReceived().subscribe(data => this.onPushReceived(data.payload));
        this.oneSignal.handleNotificationOpened().subscribe(data => this.onPushOpened(data.notification.payload));
        this.oneSignal.endInit();
}
      this.statusBar.styleDefault();
      this.splashScreen.hide();
    });
}

  private onPushOpened(payload: OSNotificationPayload) {

    let alert = this.alertCtrl.create({
      title: payload.additionalData.nodename,
      subTitle: 'My Note : '+payload.additionalData.title1+' <br/> '+'My Why  : '+payload.additionalData.mywhy,
      message: payload.body,
      buttons: [
        {
          text: 'Utsett',
          role: 'cancel',
          handler: () => {
            console.log('Cancel clicked');
          }
        },
        {
          text: 'Det er utført',
          handler: () => {
            console.log('oke');
              this.responseData = result;
              this.nav.setRoot(MynotesPage, {id:payload.additionalData.id});
            });
          }
        }
      ]
    });
    alert.present();
  }

我无法直接从“ HandleNotificationOpened”功能开始意图。任何人都可以帮助我解决这个问题。

0 个答案:

没有答案