Apple 推送通知/Ruby OpenSSL 错误

ble*_*908 5 ruby openssl ruby-on-rails apn

当尝试从我的 Rails 应用程序发送推送通知时,我收到了此消息。我确保设备令牌和 .pem 文件对于命令有效

openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert aps_development.pem -key aps_development.pem

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read finished A: tlsv1 alert internal error
    from /Library/Ruby/Gems/2.0.0/gems/houston-2.2.3/lib/houston/connection.rb:44:in `connect'
    from /Library/Ruby/Gems/2.0.0/gems/houston-2.2.3/lib/houston/connection.rb:44:in `open'
    from /Library/Ruby/Gems/2.0.0/gems/houston-2.2.3/lib/houston/connection.rb:19:in `open'
    from /Library/Ruby/Gems/2.0.0/gems/houston-2.2.3/lib/houston/client.rb:40:in `push'
Run Code Online (Sandbox Code Playgroud)

这个错误信息非常模糊,无法弄清楚发生了什么。

rub*_*ls3 3

当您收到此错误时,OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read finished A: tlsv1 alert internal error意味着您的证书有问题。证书已过期或密码已过期。

只需更新您的 Apple 推送通知证书即可。

附加说明:openssl命令并没有说明太多信息,如果您遇到需要添加-CApath-CAfile(或将该路径传递给 ENV )的情况,这可能会产生误导。

希望这有帮助。我花了将近一周的时间来解决这个问题。