I'm working on an app that receives push notifications from Zenpush service. I managed to set up both app and account on Zenpush to sent and receive notifications.
When the app is active (opened) and I receive notification - everything is OK. I handle this in application:didReceiveRemoteNotification:
.
Also, I can handle notification when user taps on it when it arrives, or opens app from the notification center.
The issue is - I can't handle notifications if the app is in the background, or terminated.
I've been struggling with this for a week now.
I have both Background fetch and Remote notifications enabled in Background modes.
In Scheme I checked "Launch due to background fetch event".
According to Apple documentation and what I've found on StackOverflow I'm using following method to handle notifications in the background: application:didReceiveRemoteNotification:fetchCompletionHandler:
.
No matter what i send in notification, this method is not called. I tried to determine this by making changes to some data, and trying to NSLog something.
https://devforums.apple.com/message/873265#873265
I include "content-available": 1 in my notifications.
Is there something else I'm missing? Or maybe there is a way to get all notifications that was receiver while app was in background/terminated where the app becomes active?