离子 - OneSignal 不适用于 iOS 13.x [英] Ionic - OneSignal doesn't work on iOS 13.x

查看:30
本文介绍了离子 - 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.

有什么建议吗?

最佳 Rgs

推荐答案

更新你的 onesignal 插件到 2.6.0 或更高版本,然后它在 ios 13 中工作正常.

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

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

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