Hi, I have Ionic-3 Onesingal integrated app. I had successfully created demo via this link .
http://masteringionic.com/blog/2017-01-06-implementing-push-notifications-with-ionic/
Actually I had nothing done any extra. I Just follow the manual of ionic 3 and above link
Here is a error log in my Xcode
2019-12-21 16:34:52.712714+0530 Ibphub[488:51186] [NetworkInfo] Signal strength query returned error: Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied", descriptor: <CTServiceDescriptor 0x281962460, domain=1, instance=1>
2019-12-21 16:34:52.737054+0530 Ibphub[488:51186] ERROR: HTTP Request (OSRequestRegisterUser) must contain app_id parameter
2019-12-21 16:34:53.004349+0530 Ibphub[488:51096] ERROR: Encountered error during push registration with OneSignal: Error Domain=OneSignalError Code=-1 "(null)" UserInfo={error=HTTP Request (OSRequestRegisterUser) must contain app_id parameter}
2019-12-21 16:34:53.004613+0530 Ibphub[488:51096] ERROR: Encountered error during email registration with OneSignal: (null)
Here is app.component.ts file
import { Component } from '@angular/core';
import { NavController, Platform } from 'ionic-angular';
import { OneSignal } from '@ionic-native/onesignal';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl : NavController,
private _PLATFORM : Platform,
private _SIGNAL : OneSignal)
{
this._PLATFORM.ready()
.then(() =>
{
this.triggerNotification();
});
}
triggerNotification()
{
// Define settings for iOS
var iosSettings = {};
iosSettings["kOSSettingsKeyAutoPrompt"] = true;
iosSettings["kOSSettingsKeyInAppLaunchURL"] = false;
// Initialise plugin with OneSignal service
this._SIGNAL.startInit(One-Signal-Application-ID-Pasted-Here, Firebase-Sender-ID-Pasted-Here).iOSSettings(iosSettings);
// Control how OneSignal notifications will be shown when
// one is received while your app is in focus
this._SIGNAL.inFocusDisplaying(OneSignal.OSInFocusDisplayOption.InAppAlert);
// Retrieve the OneSignal user id and the device token
this._SIGNAL.getIds()
.then((ids) =>
{
console.log('getIds: ' + JSON.stringify(ids));
});
// When a push notification is received handle
// how the application will respond
this._SIGNAL.handleNotificationReceived()
.subscribe((msg) =>
{
// Log data received from the push notification service
console.log('Notification received');
console.dir(msg);
});
// When a push notification is opened by the user
// handle how the application will respond
this._SIGNAL.handleNotificationOpened()
.subscribe((msg) =>
{
// Log data received from the push notification service
console.log('Notification opened');
console.dir(msg);
});
// End plugin initialisation
this._SIGNAL.endInit();
}
}
here is app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { OneSignal } from '@ionic-native/onesignal';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
@NgModule({
declarations: [
MyApp,
HomePage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [
StatusBar,
SplashScreen,
OneSignal,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}
There is nothing error in code, as I think, because App runs smoothly, but xcode console shows this error and not receiving notification.
Help me guys, I am stucked with this notification process since last 1 week.