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 推送通知不起作用


- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- PHP - if 语句中的倒序 2021-01-01