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

查看:213
本文介绍了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.

PushKit是需要VOIP功能的应用程序的更可靠替代品,在这些应用程序中,使用通知来振铃用户以进行呼叫需要更高的可靠性.这就是为什么它仍在节电模式下工作的原因.

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天全站免登陆