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

查看:26
本文介绍了使用 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

Apple 论坛问题 2

这篇关于使用 crontab 调度程序时 iOS 推送通知不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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