6 Replies Latest reply on Aug 25, 2016 9:10 PM by antonyp26843205

    IOS  app gets crashed while calling local notification

    antonyp26843205

      Hi,

           

       

      I used the local notification plug in for an Android and IOS application. It worked properly with the Android Application but I faced issues with the IOS application.

      When used in ios application I didn't receive any notifications and the app was crashing. Please help me out to find a solution.

       

      For your reference I am sending a sample code which I have used in my application :

       

       

      Config.xml : <plugin name="de.appplant.cordova.plugin.local-notification" spec="0.8.1" source="pgb" />

       

      ionicApp.run(function($ionicPlatform, $rootScope, $timeout) {

          $ionicPlatform.ready(function() {

              if(window.cordova &amp;&amp; window.cordova.plugins.Keyboard) {

                  cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

              }

              if(window.StatusBar) {

                  StatusBar.styleDefault();

              }

      });

       

       

       

      ionicApp.controller("ExampleController", function($scope, $cordovaLocalNotification) {

       

          $scope.add = function() {

              var alarmTime = new Date();

              alarmTime.setMinutes(alarmTime.getMinutes() + 1);

              $cordovaLocalNotification.add({

                  id: "1234",

                  date: alarmTime,

                  message: "This is a message",

                  title: "This is a title",

                  autoCancel: true,

                  sound: null

              }).then(function () {

                  console.log("The notification has been set");

              });

          };

       

          $scope.isScheduled = function() {

              $cordovaLocalNotification.isScheduled("1234").then(function(isScheduled) {

                  alert("Notification 1234 Scheduled: " + isScheduled);

              });

          }

       

      });

       

       

      Thanks,

      Antony