APNS 推送在前台工作但不在后台工作 [英] APNS push working in foreground but not background

查看:24
本文介绍了APNS 推送在前台工作但不在后台工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能前台推送进来,但应用在后台时收不到推送通知?

Is it possible to have foreground push come in, but not receive push notification when the app is in background?

我有一些用户报告了这个问题,并想知道可能是什么原因.也许这只是混乱?如果其他人有同样的问题,请赐教,如果有,原因是什么.谢谢!

I've had some users report this problem and was wondering what could be the cause. Maybe it's just confusion? Please enlighten me if anyone else had the same problem and if so what the cause was. Thank you!

推荐答案

从 iOS 7.0 开始,有一条新消息可以让您的 UIApplicationDelegate 在应用程序处于背景:除了application:didReceiveRemoteNotification:,现在还有一个方法application:didReceiveRemoteNotification:fetchCompletionHandler:.

Since iOS 7.0, there is a new message that your UIApplicationDelegate can respond to when a push notification arrives while the app is in the background: In addition to the application: didReceiveRemoteNotification:, there is now a method application: didReceiveRemoteNotification: fetchCompletionHandler:.

旧方法仅在应用程序处于前台或用户在锁定屏幕上侧向滑动通知时调用.始终调用带有附加 fetchCompletionHandler: 参数的新方法.仔细看看 参考,其中描述了有关如何响应此消息的一些重要细节.

The older method is only called while the app is in foreground or when the user slides the notification sideways on the lock screen. The new method with the additional fetchCompletionHandler: parameter is always called. Have a close look at the reference, which describes a few important details on how to respond to this message.

这篇关于APNS 推送在前台工作但不在后台工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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