ios推送通知并不总是显示

Posted

技术标签:

【中文标题】ios推送通知并不总是显示【英文标题】:ios push notification do not show up always 【发布时间】:2014-01-24 04:04:03 【问题描述】:

我是一名 iphone 开发人员。我正在尝试推送通知。我创建了证书、临时配置文件和 php 脚本。我尝试在终端中运行,然后它工作得很好。但是当我将它上传到我的服务器时,有时会收到通知,主要是它显示以下错误

警告:stream_socket_client() [function.stream-socket-client]:无法连接到 ssl://gateway.sandbox.push.apple.com:2195(连接被拒绝) 连接失败:111 连接被拒绝 我将 ck.pem 文件放在 php 文件的同一目录中。是否需要添加路径?

【问题讨论】:

您在生产或开发中使用哪个证书(ck.pem)? 嗨,很抱歉 delay.iam 使用 ck.pem 进行开发。我如何检查连接是否丢失?但有一件事是我很少收到通知。怎么可能? 嗨,你能尽快回复吗 【参考方案1】:

您似乎在推送通知期间失去了连接,是的,您应该添加路径 确保仔细检查您使用的端口是否正确且打开。

【讨论】:

嗨,谢谢你的回复。我如何检查连接是否丢失?我正在使用 ssl://gateway.sandbox.push.apple.com:2195。有什么错误吗?我们如何检查端口是否打开。但我很少收到通知。这怎么可能。 你好,请尽快回复 在推送通知期间我如何失去连接?你能尽快回复吗 我注意到的另一件事是,当我开始收到通知时,我收到了 3 到 4 次。之后我收到了上述错误。然后很长一段时间我收到了错误然后收到 pushnotification.what是问题【参考方案2】:

另请注意,推送通知也不总是得到保证。您可以参考https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/WhatAreRemoteNotif.html中的“更多关于推送通知”部分

Quality of Service

Apple Push Notification Service includes a default Quality of Service (QoS) component that
performs a store-and-forward function. If APNs attempts to deliver a notification but the device 
is offline, the QoS stores the notification. It retains only one notification per application 
on a device: the last notification received from a provider for that application. 
When the offline device later reconnects, the QoS forwards the stored notification to the device.
The QoS retains a notification for a limited period before deleting it.

如果设备处于离线状态(关闭或无法访问),那么它最多会收到一个您尝试在此期间发送到应用程序的推送通知。

【讨论】:

感谢您的回复。我同意您的 answer.php 脚本大多数时间显示错误并且很少发送通知。每当 php 显示消息成功传递时我都会收到通知。 你好,请尽快回复 我不确定您现在需要什么。看看这个***.com/questions/13897575/… 我认为我的问题不是可靠性。我可以问一个疑问吗?我如何检查我的服务器中的端口是否打开?端口是从打开变为关闭还是反之亦然。我试过很多.no way.你能帮帮我吗 iam 使用 filezila 连接服务器。

以上是关于ios推送通知并不总是显示的主要内容,如果未能解决你的问题,请参考以下文章

iOS 8 推送通知操作按钮 - 当应用程序在后台时,handleActionWithIdentifier 中的代码并不总是运行

如何在iOS推送通知上进行徽章增量

推送通知导致应用程序崩溃

即使 Azure 推送通知遥测显示“成功”,也未收到 iOS 推送通知

是否可以选择 iOS 推送通知仅显示在通知中心?

推送通知未在 iOS 10 设备中显示