application:didReceiveRemoteNotification:fetchCompletionHandler Not Called [英] application:didReceiveRemoteNotification:fetchCompletionHandler Not Called

查看:191
本文介绍了application:didReceiveRemoteNotification:fetchCompletionHandler Not Called的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当应用程序被强行退出时,似乎没有调用函数 application:didReceiveRemoteNotification:fetchCompletionHandler 。我的印象是,无论应用程序处于什么状态,都会调用该函数,但似乎只有在应用程序已在后台运行时才会调用它。有没有办法在后台使用新的iOS 7远程通知后台模式运行应用程序?

It appears the function application:didReceiveRemoteNotification:fetchCompletionHandler is not called when the app has been forcefully quit. It was my impression that the function would be invoked no matter what state the app was in, but it appears that it is only called if the app is already running in the background. Is there a way to wake up an app in the background if it is not already running using the new iOS 7 remote notification background mode?

推荐答案

应用程序:didReceiveRemoteNotification:fetchCompletionHandler:即使应用程序暂停,根本不运行,后台运行或处于活动状态,也会被调用。另外值得注意的是,该方法仅适用于iOS 7。这是苹果文档

application:didReceiveRemoteNotification:fetchCompletionHandler: gets called even if the app is suspended, not running at all, backgrounded, or active. Also worth noting that the method is iOS 7 only. Here is the apple documentation.

但如果应用被强行关闭(即通过应用切换器杀死) ,该应用程序将启动。(请参阅 SO回答
编辑:我在iOS 7.1上再次检查了这一点,看看他们是否解决了这个问题,但仍然存在这样的情况:如果手动杀死应用程序,应用程序将不会被唤醒并且 application:didReceiveRemoteNotification:fetchCompletionHandler:将不会被调用

HOWEVER if the app was forcibly closed (i.e. by killing with the app switcher), the app will not be launched. (see SO answer) I checked this again on iOS 7.1 to see if they fixed this, but it still remains the case that if the app is killed manually, app will NOT be woken up and application:didReceiveRemoteNotification:fetchCompletionHandler: will not be called

当接收推送时,应用程序仅在必要时被唤醒调用应用程序:didReceiveRemoteNotification:fetchCompletionHandler:方法(即你必须要et推送通知有效负载内的content-available标志。请参阅 SO回答)。如果用户随后通过点击通知打开应用程序,则该方法将再次被称为

When receiving the push, the app is only woken up only "if needed" to call the application:didReceiveRemoteNotification:fetchCompletionHandler: method (i.e. you have to set the "content-available" flag within the push notification payload. See SO answer). The method will be called again if the user then opens the app by tapping the notification.

编辑:尚未在iOS 8上检查此内容还有其他人吗?

haven't checked this on iOS 8. Has anyone else?

这篇关于application:didReceiveRemoteNotification:fetchCompletionHandler Not Called的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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