iOS:开始在后台处理推送通知?
处理接收者应用程序尚未运行时到达的推送通知的正常方法是什么?我的印象是,当应用程序启动时,我可以检测到它已启动,因为推送通知到达,然后开始在后台下载,而无需启动 GUI。但是,如果用户在下载时启动应用程序,人们通常会做什么?只是显示警告什么的?谢谢。
what is the normal way to go about dealing with a Push notification that arrives when the recipient app is not already running? I am under the impression when the app starts, I can detect that it was started because a Push notification arrived, and then start downloading in the background without ever starting the GUI. But what do people normally do if the user starts an app when that downloading is happening? Just display a warning or something? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
,这是一个糟糕的选择。 你什么也做不了。用户可能会在收到推送通知后决定打开您的应用程序。
是的。应用程序委托中的 application:didFinishLaunchingWithOptions 将传入包含推送通知数据的字典(在本例中,示例代码是本地通知):
你不能这样做。应用程序启动唯一可能的工作流程是通知 -> 用户点击“阅读更多”按钮 -> 应用程序在前台打开。
这个问题并不真正适用,因为应用程序无法在后台启动,但一般来说,如果您的应用程序在后台执行某些操作,用户不应该关心发生了什么。因此,除非应用程序运行需要数据,否则不应出现任何类型的警告。
That's a poor choice of words. You cannot do anything. The user may decide to open your app after receiving the push notification.
Yep. application:didFinishLaunchingWithOptions in your app delegate will pass in a dictionary containing push notification data (in this case, the example code is a local notification):
You can't do that. The only possible workflow for app launch is notification->user taps read more button->app opens in the foreground.
This question doesn't really apply since the app can't be started in the background, but in general users shouldn't care about what's happening if your app is doing something under the covers. Therefore, there should be no warning of any kind unless the data is required for the app to function.