Local Push works on android, not iOS

I’m using the cordova plugin local notifications and can’t get it working for iOS. It’s not even asking for permissions on opening the app. Here’s the code I’m using to trigger the prompt (in my $ionicPlatform.ready(function($ionicPlatform){});)

if(ionic.Platform.isIOS()){ 
  window.plugin.notification.local.promptForPermission();
}

I also tried window.plugin.notification.local.registerPermission();.

I jumped into Ionic without really know how / what cordova really is and how they are used together, so digging around the plugin source was a bigger can of worms than I wanted to digest right now.

Anyone know what I’m doing wrong?

There is a ngCordova version of this plugin:
http://ngcordova.com/docs/plugins/localNotification/
(ngCordova wraps popular plugins to be easily used in Ionic/Angular)

Looking at the examples there should help.

Hm, I can’t seem to get it to work. Following the examples it won’t load the app, saying $cordovaLocalNotification is missing. I’ll try on a fresh Ionic project.

I solved my issue. I originally followed this guide: http://devdactic.com/local-notifications-ionic/ and got the results I posted. I never ran ionic platform add ios since I figured it’s added by default so I didn’t need to. I believe it was an issue with cordova plugins being added without / before a platform is added which I’ve heard causes quite a bit of errors like this one.

1 Like