使用crontab调度程序时,iOS推送通知不起作用

Kri*_*nan 20 php crontab push-notification

我已经为我的应用程序实现了示例推送通知服务.

现在我在沙盒环境中测试.

当我手动调用PHP脚本通过APN推送通知时,我收到通知.

当我使用crontab编写调度程序来自动传递通知时,我没有收到通知.我收到的邮件错误是:

PHP Warning:  stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure in /Users/aspire/Desktop/SimplePush/simplepush.php on line 21
PHP Warning:  stream_socket_client(): Failed to enable crypto in /Users/aspire/Desktop/SimplePush/simplepush.php on line 21
PHP Warning:  stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /Users/aspire/Desktop/SimplePush/simplepush.php on line 21
Failed to connect: 0 
Run Code Online (Sandbox Code Playgroud)

有人可以解释问题是什么吗?

Kri*_*nan 49

这个问题已得到解决.真正的问题出在我使用的PHP脚本中.

stream_context_set_option II中的早期版本没有包含ck.pem文件的完整路径.在给出完整路径之后没有错误.以下是我现在使用的代码.

$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', '/Users/Development/Dev/ck.pem');
Run Code Online (Sandbox Code Playgroud)

其他一些有这个问题的人和他们的讨论是

Apple论坛问题1

Apple论坛问题2

  • 你节省了我的一天,因为其他人都在说它与openssl版本有关,谢谢 (2认同)