我正在阅读如何处理开发者苹果指南上的远程通知。我的问题有两个: 这句话的解释是什么
The notification is delivered when the application isn’t running in the foreground
不是在前台运行覆盖后台和不运行或只是在后台状态。根据解释,下面的句子:
the application icon is tapped on a device running iOS, the application calls the same method, but furnishes no information about the notification.
有不同的意义。
第二个问题是关于我连续收到两次远程通知的情况:当我在方法中打开应用时
application:didFinishLaunchingWithOptions: or application:didReceiveRemoteNotification:
我有所有通知的信息还是只有最后一个?
最佳答案
- 如果您的应用程序正在运行,无论是在后台暂停状态还是在前台,收到通知时调用的方法将始终是
application:didReceiveRemoteNotification:
。 - 如果您的应用程序根本没有运行,在收到通知后启动时,它将触发
application:didFinishLaunchingWithOptions:
并且选项将是一个non-nil
对象包含有关您的远程通知的信息。 - 据我所知,只有最后的通知信息可用。
关于ios - 处理远程通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10335762/