如何在应用程序关闭时接收推送通知?
我正在为我的应用程序实现推送通知功能,除了一种情况外,一切都运行顺利。
情况是这样的: 当应用程序关闭(也不在后台运行)并且用户收到推送通知时。用户点击“关闭”,然后决定转到该应用程序。我希望我的应用程序代表知道之前收到的推送通知,但是我不知道如何检查。我知道我可以在 didLaunch 中进行函数调用...但是当用户决定点击“查看”按钮而不是“关闭”时,它就会起作用。
有什么提示吗?
谢谢!
I am implementing a push notification functionality for my app and everything is running smoothly except for one case.
The situation is this:
When the app is off (not running in background either) and the user receives a push notification. The user hits "Close" and then later on decides to go to the app. I would like my app delegate to know the push notification that was received earlier however, I don't know how to check that. I know that I can have a function call in my didLaunch... but that works when the user decides to hit the "View" button instead of "Close".
Any hints?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确实,答案是不要打扰。您永远无法保证收到警报,因此不幸的是,如果您依赖于此,您稍后会遇到问题。 apns 不保证设备会收到有效负载。
Really, the answer is don't bother. You can never guarantee that the alert was received, so unfortunately you'll run into problems later if you rely on this. apns doesn't guarantee a device will receive a payload.