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

查看:391
本文介绍了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 可以当一个推送通知到达响应而应用程序在后台:除了应用程序:didReceiveRemoteNotification:,现在有一种方法应用程序: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的新方法:参数总是被调用。有一个在<一仔细看href=\"https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/index.html#//apple_ref/occ/intfm/UIApplicationDelegate/application:didReceiveRemoteNotification:fetchCompletionHandler:\"相对=nofollow>参考,它描述了如何对这一消息作出回应一些重要的细节。

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