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:

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...