ios - 点击应用程序图标时无法获得推送(远程)通知

标签 ios background apple-push-notifications payload

根据Local and Remote Notification Programming Guide ,当发送远程通知并且您点击 SpringBoard 中的应用程序图标时:

The user taps the default button in the alert or taps (or clicks) the app icon. If the default action button is tapped (on a device running iOS), the system launches the app and the app calls its delegate’s application:didFinishLaunchingWithOptions: method, passing in the notification payload (for remote notifications) or the local-notification object (for local notifications).

If the notification is remote, the system also calls application:didReceiveRemoteNotification:fetchCompletionHandler:.

但是,当我看到远程通知标志并点击应用程序图标时,application:didFinishLaunchingWithOptions:(应用程序将在后台运行)和 application:didReceiveRemoteNotification:,也不是 application:didReceiveRemoteNotification:fetchCompletionHandler: 被调用...

我在点击横幅或警报时成功获取了推送通知的有效负载,我如何在点击应用程序图标时也能获取它?

谢谢

最佳答案

您需要继续阅读。您引用的部分的其余部分是 -

If the app icon is clicked on a computer running OS X, the app calls the delegate’s applicationDidFinishLaunching: method in which the delegate can obtain the remote-notification payload. If the app icon is tapped on a device running iOS, the app calls the same method, but furnishes no information about the notification.

请注意我加粗的部分。简短的回答是,如果应用程序是从应用程序图标启动的,则不会提供有关可能已收到的任何通知的信息。

关于ios - 点击应用程序图标时无法获得推送(远程)通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31939488/

相关文章:

android - 为所有屏幕尺寸设置背景图像

iOS NSNotificationCenter 检查app是否从后台转到前台

ios - 使用新的基于 token 的身份验证进行 VoIP 推送?

ios - 为什么我无法在 iOS 10 中处理收到的推送通知?

ios - 如何为UIWebView添加背景图像?

来自一台服务器的多个应用程序的 IOS 推送通知

ios - 如何将图像保存到iOS 9.0中的特定文件夹

ios - 是否可以在不更新应用的情况下向应用添加应用内购买?

ios - UILabel 剪切文本顶部

ios - 查询 NearGeoPoint 返回空对象