iOS11 swift silent push (background fetch, didReceiveRemoteNotification) is not working anymore

让人想犯罪 __ 提交于 2019-11-27 08:29:32

Final UPDATE 2017-10-31

Apple just had its official (Halloween) release of iOS 11.1

UPDATE 2017-10-09

Apple released iOS11.1 beta 2 today. Again they mentioned in their Release Notes the following note:

Notifications Resolved Issues

Silent push notifications are processed more frequently. (33278611)

I'm going to test again this beta 2 version and update this answer for your information.

UPDATE - Testing -> After some testing with different scenarios this bug seems to be fixed within the latest iOS11.1 beta 2 version. Now we can only wait for the official release. In some forums they assume that Apple will release iOS11.1 in late October.


Older post

I investigated a lot of time the last week to look for an answer regarding this issue. After reading the apple release notes (incl. the deprecated, changed and new functions) I tested the following situation:

I added the empty function to my AppDelegate and now the silent push works again both in foreground and also in background:

func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
        logger.log.debug("Perform Fetch with completion handler TEST")
    }

I'm not sure if this 'workaround' is related to the issue, that the following function application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) is not called in iOS11.

Nevertheless you can give it a try and give me feedback, if you identify the same behavior.

UPDATE 2017-09-25

The 'silent push' works now in my case in foreground and background mode, but not, if the app is suspended either from the user or from the OS. So this issue is still open and not fixed - any help appreciated! For more information see also this thread: Silent pushes not delivered to the app on iOS 11


UPDATE 2017-10-05

Apple released iOS11.1 beta some days ago. They mentioned in their Release Notes the following:

Notifications Resolved Issues
Silent push notifications are processed more frequently. (33278611)

Some developers are saying that the issue is fixed with this beta, other developers say that the issue is still present within some circumstances. Now it would be interesting when Apple is launching iOS11.1 for the customers.

What you experience is actually a well-documented behaviour rather than a bug.

Apple's documentation says: "The system treats silent notifications as low-priority. You can use them to refresh your app’s content, but the system doesn't guarantee their delivery. In addition, the delivery of silent notifications may be throttled if the total number becomes excessive. The actual number of silent notifications allowed by the system depends on current conditions, but don't try to send more than two or three silent notifications per hour."

In summary, silent notification is not guaranteed to wake up your app. Why? The more often the app in the background on the user's device is woken up, the higher the battery consumption is.

According to IBM's statement, it says "With the advent of iOS 11, Apple has introduced changes in the way they handle certain kinds of push messages. This was done to improve battery life, but comes at a cost of user experience that is likely to affect your app." You can find more details here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!