应用程序处于后台时收到的远程通知未命中“didReceiveRemoteNotification - fetchCompletionHandler";如果应用程序被杀死的方法? [英] Remote Notification received while app is background doesn't hit "didReceiveRemoteNotification - fetchCompletionHandler" method if app is killed?

查看:66
本文介绍了应用程序处于后台时收到的远程通知未命中“didReceiveRemoteNotification - fetchCompletionHandler";如果应用程序被杀死的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经实现了以下方法来接收远程通知并启用项目能力下的后台获取和远程通知".即使应用程序在前台或后台,方法也会命中.但是如果应用程序被杀死,在后台收到通知,则不会调用以下方法".如何解决这个问题?

We had implemented following method to receive remote notification and enabled "Background Fetch and Remote Notification under Capabilities of a project". Method is hitting even if app is in foreground or background. But "If app is killed, received notification in background then following method doesn't get called". How to fix this?

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
// Some storage code
}

提前感谢您的帮助!

推荐答案

间接终止应用会禁用推送通知.

Killing the app indirectly disables push notifications.

这是因为如果用户杀死应用程序,操作系统不会重新启动它,除非用户点击主屏幕上的应用图标.

This is because if the user kills the app, the OS will not relaunch it unless the user taps the app icon on the home screen.

这很不幸,因为大多数用户不知道杀死应用程序(这很有趣!)有这些令人讨厌的附带影响.

This is unfortunate, because most users don't know that killing apps (which is fun!) has these annoying collateral effects.

这篇关于应用程序处于后台时收到的远程通知未命中“didReceiveRemoteNotification - fetchCompletionHandler";如果应用程序被杀死的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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