根据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/