处理远程通知 [英] Handling Remote Notifications
问题描述
我正在阅读如何处理开发者苹果指南上的远程通知.我的问题有两个:这句话的解释是什么
I was reading how handling remote notification on developer apple guide. My questions are two: what is the interpretation of the phrase
当应用程序未运行时传递通知前景
The notification is delivered when the application isn’t running in the foreground
is not running in the foreground 覆盖了后台并且不运行或只是在后台状态.根据解释,以下句子:
isn’t running in the foreground covers background and not running or in the background state just. Based on the interpretation, the following sentence:
在运行 iOS 的设备上点击应用程序图标,应用程序调用相同的方法,但不提供有关通知的信息.
the application icon is tapped on a device running iOS, the application calls the same method, but furnishes no information about the notification.
有不同的意义.
第二个问题是关于我连续收到两次远程通知的情况:当我在方法中打开app时
The second question concerns the situation where I get two consecutive remote notifications: When I open the app in the method
应用程序:didFinishLaunchingWithOptions:或者应用程序:didReceiveRemoteNotification:
application:didFinishLaunchingWithOptions: or application:didReceiveRemoteNotification:
我有关于所有通知的信息还是只有最后一条?
I have information on all notifications or just the last?
推荐答案
- 如果您的应用程序正在运行,无论是在后台挂起状态还是在前台,收到通知时调用的方法将始终是
application:didReceiveRemoteNotification:
. - 如果您的应用程序根本没有运行,在收到通知后启动时,它将触发
application:didFinishLaunchingWithOptions:
并且选项将是一个non-nil
对象包含有关您的远程通知的信息. - 据我所知,只有最后一条通知信息可用.
- If your application is running, either in background suspended state or foreground, the method that will get called upon receiving a notification will always be
application:didReceiveRemoteNotification:
. - If your application is not running at all, upon launch after receiving a notification, it will trigger
application:didFinishLaunchingWithOptions:
and the options will be anon-nil
object containing information about your remote notification. - As far as I know, only the last notification info is available.
这篇关于处理远程通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!