katzer / cordova-plugin-local-notifications

Cordova Local-Notification Plugin
Apache License 2.0
2.57k stars 1.75k forks source link

Plugin is not working on iOS (12) #1731

Closed frissonlabs closed 5 years ago

frissonlabs commented 5 years ago

Local notifications does not work at all with my configuration.

Your Environment

Expected Behavior

I was trying to run Local Notification on IOS 12 and should get a notification

Actual Behavior

I'm getting no local notifications

Steps to Reproduce

Reproduce this issue; include code to reproduce, if relevant

  1. Create test app using "ionic start test blank"
  2. Add iOS platform using "ionic cordova platform add ios"
  3. Add plugin via cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git
  4. Add Ionic Native wrapper via npm install --save @ionic-native/local-notifications
  5. Add plugin to "app.module.ts" via https://ionicframework.com/docs/native/#Add_Plugins_to_Your_App_Module
  6. Add test code within "app.component.ts" to prompt local notification:
    platform.ready().then(() => {
        this.localNotifications.schedule({
             title: "My first notification",
             text: "Thats pretty easy...",
             foreground: true
        });
    })
  7. Run "ionic cordova build ios"
  8. Deploy to device (or simulator, bug occurs on both environments)

Context

Trying to schedule local notifications

Debug logs

2018-12-07 17:08:18.021316-0800 MyApp[18142:790963] CDVPlugin class APPLocalNotification (pluginName: LocalNotification) does not exist.
2018-12-07 17:08:18.021490-0800 MyApp[18142:790963] ERROR: Plugin 'LocalNotification' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2018-12-07 17:08:18.021652-0800 MyApp[18142:790963] FAILED pluginJSON = ["LocalNotification1411168148","LocalNotification","request",[]]
frissonlabs commented 5 years ago

I figured out a workaround: you have to add (or re-add) the platform AFTER you add the plugin, not before.

sanket-webmavens commented 4 years ago

This is not the good workaround, it still happening for me even in 2019. Any help is appreciated please.

ragcsalo commented 4 years ago

I also don't get any notifications on iOS 13, however, the phone vibrated once (but no message is displayed). Any advice how to make it right? Do I have to add an APN certificate to get it working?