Receive push notifications in the background of iOS

I am working on an application that receives push notifications from Zenpush. I was able to configure the application and account on Zenpush to send and receive notifications.

When the application is active (open) and I receive a notification, everything is in order. I process it in application:didReceiveRemoteNotification:.

In addition, I can handle notifications when a user clicks on him, when he arrives, or opens an application from the notification center.

Problem: I cannot process notifications if the application is in the background or is completed. I have been struggling with this for a week. I have Background fetch and Remote notifications included in Background modes . In the diagram, I checked "Launch due to background fetch event". According to the documentation, and Apple that I found in the StackOverflow, I use the following method of notification processing in the background: application:didReceiveRemoteNotification:fetchCompletionHandler:.

No matter what I send in the notification, this method is not called. I tried to determine this by making changes to some data and trying something NSLog.

https://devforums.apple.com/message/873265#873265

I include “content-accessible”: 1 in my notifications.

- , ? , , , , /, ?

+4
1

application:didReceiveRemoteNotification:fetchCompletionHandler: , Zenpush. , Custom Payload content-available - . content-available asp, .

Zenpush , , content-available asp,

Update:

Zenpush. .

2:

Zenpush , . enter image description here

+1

Source: https://habr.com/ru/post/1534470/


All Articles