Ionic - OneSignal doesn't work on iOS 13.x

主宰稳场 提交于 2020-01-25 08:53:42

问题


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

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

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 info:

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 plugin list:

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"

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

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

any suggestions?

Best Rgs


回答1:


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



来源:https://stackoverflow.com/questions/59039396/ionic-onesignal-doesnt-work-on-ios-13-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!