【发布时间】:2017-11-26 00:42:10
【问题描述】:
我目前正在构建一个 laravel 提供者服务来向 IOS 设备发送推送通知。我按照this 教程创建了一个能够接收通知的示例应用程序。
在我的服务器端,我使用this 包来处理推送通知。
在测试期间,当设备连接到 wifi/4G 时,在前台/后台/非活动模式下,应用程序设法接收推送通知。但是,如果我在应用程序离线时向应用程序发送推送通知,则在将设备连接回互联网时,我不会收到任何通知。
根据苹果文档,APNS 服务存储设备离线时发送的任何通知,并在重新建立连接后将其传递给客户端。如果设备长时间处于离线状态(未准确指定持续时间),它应该处理任何通知。但是,在上线之前,我只让设备离线一分钟。有人可以提出解决方案吗?
【问题讨论】:
-
你误会了。除非您指定
apns-expiration..If this value is nonzero, APNs stores the notification and tries to deliver it at least once, repeating the attempt as needed if it is unable to deliver the notification the first time. If the value is 0, APNs treats the notification as if it expires immediately and does not store the notification or attempt to redeliver it.,否则不会重新发送通知 -
谢谢布兰登。当我阅读文档时,这完全让我无法理解。
-
然而,我在上面提到的 laravel 推送通知包中集成到期有效负载时遇到了问题。有谁知道如何设置有效期?
标签: ios laravel apple-push-notifications