Let's code

Follow the below steps to create the example app:

  1. Now, create a new MyiOSPush app using the blank template, as shown, and go to the MyiOSPush folder:
$ ionic start MyiOSPush blank
$ cd MyiOSPush
  1. Install the Cordova plugin and Ionic Native wrapper for OneSignal:
$ ionic cordova plugin add onesignal-cordova-plugin$ npm install --save @ionic-native/onesignal

We need to add this ionic-native plugin to app.module.ts.

  1. We also need to install cocoapods. Go to Terminal, and install it as follows:
sudo gem install cocoapodspod repo update
  1. Open and edit ./src/app/app.module.ts with the following content:
import { BrowserModule } from '@angular/platform-browser';import { ErrorHandler, NgModule } from '@angular/core';import { IonicApp, ...

Get Ionic Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.