SDK

Implementation

If you've completed the steps described in the Setup guides, you are now ready to implement our Cordova plugin for iOS in your app. Our plugin supports iOS 9 and up.

To start please make sure you have followed the Getting started with Cordova tutorial. Once you have met all the requirements and you have prepared your machine for Cordova development you can then start implementing our module.

Install the Plugin

Open the terminal under your project root directory and execute the following command:

cordova plugin add cordova-plugin-notificare-push

As soon as the plugin is installed, you can open the project's workspace using the following command:

open platforms/ios/MyApp.xcworkspace

Where MyApp should be the name of your project.

Configure your App

You will need to add some files included in our native library. For that, please download our latest release here. Unzip the downloaded file and open the resulting folder, then drag and drop Notificare.plist into your Xcode project:

drag drop plist

It is recommended that you create at least two different apps in Notificare using separated environments for development and production. For each app you will have a different set of keys, these keys should be copied and pasted in the file shown above. The DEVELOPMENT property should be set to YES or NO according to the environment you are building for. You can find your app keys by expanding your app's Settings menu item and clicking in App Keys as shown below:

menu

Copy both the Application Key and Application Secret:

keys

And paste them accordingly in the Notificare.plist file:

xcode plist app keys

Entitlements

Before you can start implementing our library code, you will need to add all the capabilities to your project. Go to your app's target and click in the tab Capabilities:

xcode capabilities tab

By default, we will enable Push Notifications and Remote Notifications background.

If you've subscribed to the Loyalty add-on and you will handle digital cards, then you should turn the Wallet capability ON:

xcode capabilities wallet

If you've subscribed to the Monetize add-on and you will sell digital products in your app, then you should turn the In-App Purchase capability ON:

xcode capability in app purchase

If you've subscribed to the Users & Authentication add-on and you will implement OAuth2 features in your app, then you should turn the Keychain Sharing capability ON:

xcode capability keychain sharing

If you are going to implement the NFC Reader capabilities of our library, you must turn the Near Field Communication Tag Reading capability ON:

xcode capability nfc

Implementation

You are now ready to start implementing functionality in javascript. Open your index.js file and add the following inside the deviceready listener:

document.addEventListener('deviceready', function(){

    Notificare.launch();

    Notificare.on('ready', function(app){

    });

    ... more code

}, false);

At this point, you have completed the basic setup of our library. Keep reading our implementation guides to dive deeper into each feature available in our SDK.