IOS9 推送省电模式 - 未调用 didReceiveRemoteNotification [英] IOS9 Push Battery Saver Mode - didReceiveRemoteNotification not called

查看:24
本文介绍了IOS9 推送省电模式 - 未调用 didReceiveRemoteNotification的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在IOS9上,如果iPhone处于省电模式,回调

On IOS9 if an iPhone is in battery save mode, the callback

application:didReceiveRemoteNotification:fetchCompletionHandler: 

未被调用.相反,我在控制台中收到以下警告

is not called. Instead I get the following warning in the console

High Priority Push: com.your-company.app - Battery Saver Mode Enabled

当使用 PushKit 时,它似乎确实可以工作.

When using PushKit it does seem to work.

还有其他人经历过这种行为吗?

Does anybody else experience this behaviour?

还有其他解决方法吗?

推荐答案

不幸的是,我相信这是预期的行为.关于推送通知的文档不断地对冲它们的可靠性.例如:

I believe, unfortunately, that this is the intended behavior. The documentation about push notifications constantly hedges their reliability. E.g.:

https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html

重要提示:发送通知是尽力而为",而不是保证.它并非旨在向您的应用程序提供数据,仅用于通知用户有新数据可用

Important: Delivery of notifications is a "best effort", not guaranteed. It is not intended to deliver data to your app, only to notify the user that there is new data available

在很多情况下,通知不会发送或延迟发送,有时 Apple 会合并多个通知,只发送最后一个.

There are a lot of conditions under which notifications won't be delivered or delivery will be delayed, and sometimes Apple will coalesce multiple notifications and only deliver the last one.

对于需要 VOIP 功能的应用程序来说,PushKit 是一种更可靠的替代品,在这些应用程序中,使用通知为用户拨打电话需要更好的可靠性.这就是它仍然在省电模式下工作的原因.

PushKit is a more reliable replacement for applications that want VOIP functionality, where using a notification to ring the user for a call needs better reliability. That's why it's still working in battery-save mode.

就解决方法而言,这实际上取决于您要完成的工作.一种可能性是您可以在应用运行时安排本地通知,这将比标准远程通知更可靠.

In terms of workarounds, it really depends what you're trying to accomplish. One possibility is you can schedule local notifications while your app is running, and those will be more reliable than the standard remote ones.

这篇关于IOS9 推送省电模式 - 未调用 didReceiveRemoteNotification的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆