iphone - Apns 错误 "Failed to connect to APNS: 110 Connection timed out."

标签 iphone ios ipad apple-push-notifications apns-php

我已经从这个 Apns code 为 php 和 objective-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 设备发送通知?任何人都可以指导我吗?

最佳答案

最后我选择了 vps 而不是共享主机。 Lucabro 的评论帮我解决了。谢谢 Lucabro。

关于iphone - Apns 错误 "Failed to connect to APNS: 110 Connection timed out.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19025488/

相关文章:

ios - 在 iOS 中旋转时调整 UITextView 的大小

iphone - 将 Dicom 图像转换为 jpg,png

iPhone:使用touchesBegan、touchesMoved和touchesEnded平移移动图像

iphone - 为表格 View 中的单元格设置可变高度

ios - 如何从 Swift 3 中的闭包返回

iphone - 对某些库使用 -all_load 但对某些库不使用

ios - 如何在 Objective C 中将 NSLog 分类为错误、警告、消息和故障类型

iPhone 远程音频单元回调

iphone - 如何在后台中断后恢复 AVAudioPlayer

ios - 在 openGL 中设置和访问多个纹理