我是iphone开发者。我正在尝试推送通知。我创建了证书,临时配置文件和PHP脚本。我尝试在终端中运行,然后它工作得很好。但是当我在我的服务器上传它时,通知有时主要显示以下错误
警告:stream_socket_client()[function.stream-socket-client]:无法连接到ssl://gateway.sandbox.push.apple.com:2195(拒绝连接) 连接失败:111连接被拒绝 我将ck.pem文件放在php文件的同一目录中。是否需要添加路径?
答案 0 :(得分:0)
在推送通知期间,您似乎丢失了连接,是的,您应该添加路径 确保你仔细检查你使用的端口是否正确并打开。
答案 1 :(得分:0)
另请注意,推送通知也不总是得到保证。您可以在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.
如果设备处于离线状态(关闭或无法访问),则在此期间,您最多会收到一次尝试发送到应用程序的推送通知。