【发布时间】:2013-10-02 06:13:17
【问题描述】:
我已经从 Apns code 为 php 和目标 c 完成了 apns 代码
并从this link设置证书
用于向 ios 设备发送通知的沙盒和生产 apns 在我的服务器上运行良好。我将代码和相同的证书移动到客户端服务器,然后发送通知不起作用。
我调试了所有php代码,发现停在这行代码
private function _connectSSLSocket($development) {
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', $this->apnsData[$development]['certificate']);
$this->sslStreams[$development] = stream_socket_client($this->apnsData[$development]['ssl'], $error, $errorString, 100, (STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT), $ctx);
if(!$this->sslStreams[$development]){
$this->_triggerError("Failed to connect to APNS: {$error} {$errorString}.");
unset($this->sslStreams[$development]);
return false;
}
return $this->sslStreams[$development];
}
apns.log 文件显示错误“无法连接到 APNS:110 连接超时。”
没有弄错。为什么我收到此错误而不向 ios 设备发送通知?有人可以指导我吗?
【问题讨论】:
-
您客户端的服务器可能位于阻止端口 2195 的防火墙后面。
-
stackoverflow.com/questions/18085086/… 代理服务器导致的同样问题未解决,我们发现的唯一方法是允许直接连接到 apns
-
啊,这样的问题你在共享主机中也会出现
-
感谢大家的评论。是的,我有共享主机。有什么解决办法吗?
-
尝试寻找 VPS 或外部服务来推送通知,例如 push.io 或 pushwoosh.com 或 openpush.im
标签: iphone ios ipad apple-push-notifications apns-php