7

It have been a white I'm facing a issue while integrating one-signal to my app for iOS i followed every thing in the ionic guide and one-signal but getting this error

ERROR: Encountered error during push registration with OneSignal: Error Domain=OneSignalError Code=400 "(null)" UserInfo={returned={ errors = ( "app_id not found. You may be missing a Content-Type: application/json header." ); }}

I'm sure the app_id is correct

any body help this is my code :

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


  // Okay, so the platform is ready and our plugins are available.
  // Here you can do any higher level native things you might need.
  statusBar.styleDefault();
  splashScreen.hide();

if(platform.is('ios')){
    console.log('platform is ios using onsignail for ios');
    this.oneSignal.startInit('bae0c3e1-bc4e-49ab-9274-18635XXXXX', );

this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.InAppAlert);

this.oneSignal.handleNotificationReceived().subscribe(() => {
    // do something when notification is received
});

this.oneSignal.handleNotificationOpened().subscribe(() => {
    // do something when a notification is opened
});

this.oneSignal.endInit();

}

this is the output in xcode console

ERROR: Encountered error during push registration with OneSignal: Error Domain=OneSignalError Code=400 "(null)" UserInfo={returned={ errors = ( "app_id not found. You may be missing a Content-Type: application/json header." ); }} 2018-09-20 09:48:39.056130+0100 Baby Fashion[514:115983] ERROR: Encountered error during email registration with OneSignal: (null)

thank you for your help

core114
  • 5,155
  • 16
  • 92
  • 189
qasmaoui
  • 103
  • 1
  • 7

1 Answers1

0

You need to start OneSignal as soon as possible, else it will not provide app_id while app trying to hook plugin with ios and it will throw error.

And you have code inside platform.ready method so oneSignal taking time to initialize while plugin trying to hook.

You also need to set firebase project id to enable push notification for Android app.