Search code examples
cordovaionic-frameworklocalnotification

local notification with ionic on iOS does not work


I'm trying local notification on a new Ionic blank app. But I can't have the notifications triggered on iOS (I have an iPhone 5 with iOS 9.3). Everything's working on Android but not on iOS. First I thought it was a notification permission problem, so I started to implement the hasPermission function, but it didn't work better. So I tried to add the notification registering directly in the Objective-C code. I got the message to activate notifications for this app, but then, the notifications still doesn't work when I click on my app's buttons.

Just to summarize, I simplified the code and the following one works fine on Android but on iOS, it only displays the "test permission" alert :

app.controller('NotificationController', function($scope, $cordovaLocalNotification, $ionicPlatform) {
    $ionicPlatform.ready(function () {
    alert('test permissions !');
    window.plugin.notification.local.hasPermission(function (granted) {
        alert('Permission has been granted: ' + granted);
    });
    ... 

What am I missing on iOS ?

Thanks !


Solution

  • Here is a working answer on github : https://github.com/katzer/cordova-plugin-local-notifications/issues/1031#issuecomment-232391644