Ionic-OneSignal在iOS 13.x上不起作用 [英] Ionic - OneSignal doesn't work on iOS 13.x

查看:225
本文介绍了Ionic-OneSignal在iOS 13.x上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的ionic 3应用程序和OneSignal出现问题.

I have a problem with my ionic 3 app and OneSignal.

该应用程序在Android版本和iOS版本12.x上均可正常运行,但在iOS 13. *上则没有任何反应.

The app working fine on Android version and iOS version 12.x, but in iOS 13.* nothing happends.

在OneSignal仪表板中查看未注册的设备.我也没有在我的应用程序中获得玩家ID(调用getIds()方法).

Viewing in the OneSignal Dashboard the device not registered. I also don't get the playerid in my app (calling getIds() method).

app.component.ts:

  constructor(platform: Platform, 
              statusBar: StatusBar, 
              private oneSignal: OneSignal,
              public api: ApirestProvider,
              private alertCtrl: AlertController,
              splashScreen: SplashScreen) {
    platform.ready().then(() => {
      statusBar.styleDefault();
      splashScreen.hide();
      this.handlerNotifications();
    });
  }

  private handlerNotifications(){
    this.oneSignal.startInit('xxxxxxxxxxxxxxxxxxxxxxxxxx', 'xxxxxxxxxxxxx');
    this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.Notification);
    this.oneSignal.handleNotificationOpened()
    .subscribe(jsonData => {
      let alert = this.alertCtrl.create({
        title: jsonData.notification.payload.title,
        subTitle: jsonData.notification.payload.body,
        buttons: ['OK']
      });
      alert.present();
    });

    this.oneSignal.getIds().then(identity => {
      console.log("Player ID:" + identity.userId);
      this.api.player_id=identity.userId;
    }).catch(err => {
      this.api.showMsg("Error en getIds():" + err);
    }); 

    this.oneSignal.endInit();

  }

离子信息:

Ionic:

   Ionic CLI          : 5.4.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.1

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : ios 4.5.5
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.1, (and 14 other plugins)

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v10.16.3 (/usr/local/bin/node)
   npm    : 6.9.0
   OS     : macOS Mojave
   Xcode  : Xcode 11.2.1 Build version 11B500

cordova插件列表:

cordova-open-native-settings 1.5.2 "Native settings"
cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-advanced-http 2.0.2 "Advanced HTTP plugin"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-email-composer 0.9.1 "EmailComposer"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-googlemaps 2.4.6 "cordova-plugin-googlemaps"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 2.3.1 "cordova-plugin-ionic-webview"
cordova-plugin-network-information 2.0.2 "Network Information"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
mx.ferreyra.callnumber 0.0.2 "Cordova Call Number Plugin"
onesignal-cordova-plugin 2.4.6 "OneSignal Push Notifications"

在XCODE iPhone模拟器(目标iOS 13.2.2/iPhone 11)上运行项目可以正常工作,进行订阅并获取播放器ID.

Running the project on XCODE IPhone simulator (Target iOS 13.2.2 / iPhone 11) working fine, making the subscription and getting the player id.

它仅在实际设备iPhone 13.x上不起作用.

It just doesn't work on real devices iPhone 13.x.

有什么建议吗?

最佳角色

推荐答案

使用2.6.0或更高版本更新onesignal插件,然后在ios 13中可以正常工作.

Update your onesignal plugin with version 2.6.0 or above, then it's working fine in ios 13 .

这篇关于Ionic-OneSignal在iOS 13.x上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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