iOS push notification does not work when using crontab scheduler(使用 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 推送通知不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 crontab 调度程序时 iOS 推送通知不起作用
基础教程推荐
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 如何替换eregi() 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
