ios – 在终止后通过推送通知启动应用程序

前端之家收集整理的这篇文章主要介绍了ios – 在终止后通过推送通知启动应用程序前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想知道是否有办法唤醒用户在ios8-9上终止的应用程序.终止后,我的意思是双击主页按钮并向上滑动.

是否有可能通过发送静默推送通知来启动应用程序,以便确实触发了重新启动,并给了我一些运行时间?

我注意到我的用户公平分享了我的应用程序.由于我非常依赖后台提取,这是一个问题.我的想法是发送静默推送通知以在后台启动应用程序并触发后台提取.

解决方法

简答:不,这是不可能的.

详情:

当服务器上有任何新内容时,您将向您的应用程序发送远程通知通知相关内容. (远程通知实际上只是设置了content-available标志的普通推送通知)

当应用程序收到此远程通知时,它会调用以下方法

- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler

在这种方法的文档中,它写得很清楚:

However,the system does not automatically launch your app if the user
has force-quit it. In that situation,the user must relaunch your app
or restart the device before the system attempts to launch your app
automatically again.

参考:

> objc.io: Remote Notifications
> Apple Doc about application:didReceiveRemoteNotification:fetchCompletionHandler:

原文链接:https://www.f2er.com/iOS/331928.html

猜你在找的iOS相关文章