使用crontab调度程序时,iOS推送通知不起作用 [英] iOS push notification does not work when using crontab scheduler

查看:125
本文介绍了使用crontab调度程序时,iOS推送通知不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have implemented a sample push notification service for my App.

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

Right now I test in a sandbox environment.

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

I get notifications when I manually call the PHP script to push notifications through APN.

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

When I write a scheduler using crontab to automate the delivery of notifications I dont get the notifications. The error I get as a mail is:

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 

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

Can someone explain what the problem could be?

推荐答案

此问题已解决.真正的问题出在我使用的PHP脚本中.

This problem was fixed. The real issue was in the PHP script I used.

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

Earlier in the stream_context_set_option I I did not include the full path to the ck.pem file . After giving the full path there was no error. Below is the code I am using right now.

$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', '/Users/Development/Dev/ck.pem');

其他一些有此问题的人,他们的讨论是

Some others who have had this problem and their discussions are

Apple论坛问题1

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆