ben-xD / push

Push notifications in Flutter without firebase_messaging.
https://pub.dev/packages/push
37 stars 23 forks source link

onNotificationTap handler is not triggered on iOS #30

Closed Arley011 closed 1 year ago

Arley011 commented 1 year ago

The package is great and everything works fine except onNotificationTap on iOS. It is not triggered at all for me.
I'm also using flutter_local_notifications and was thinking that the problem is in some conflict of handlers. But onNotificationTap is not getting triggered even when I removed local notifications plugin. I also tried to not use onNotificationTap and use local notification's onSelectNotification, but it also stopped working.
Previously I was using flutter_apns and it was working fine.

Arley011 commented 1 year ago

SOLVED. After hours of investigation the thing that helped me and fixed onNotificationTap was removing this line of code from AppDelegate.swift:
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate

Adding this was required in flutter_apns plugin. After changing plugin to push I didn't remove it and it was the thing that was preventing push and flutter_local_notification handlers to be called.

Maybe this will help somebody to save time and effort. Closing the issue.

P.S. I suggest adding that info at package's documentation :)