首页 > 解决方案 > 无法连接到 APN:无法连接:tls://gateway.sandbox.push.apple.com:2195: 2 (stream_socket_client(): 无法设置本地证书链文件

问题描述

问题

我进行了广泛的搜索,试图解决这个试图从 laravel 运行推送通知的问题,使用https://github.com/laravel-notification-channels/apn

这是我在 broadcasting.php 中的 apns 配置:

apn => [
            'environment' => \NotificationChannels\Apn\ApnChannel::SANDBOX, // Or ApnChannel::SANDBOX
            'certificate' => base_path('ApnsDev.pem'),
            'pass_phrase' => 'MY_PASSWORD', // Optional passPhrase
 ],

这是我不断从 bash 中得到的错误:

NotificationChannels\Apn\Exceptions\ConnectionFailed:无法连接到 APNs:无法连接:tls://gateway.sandbox.push.apple.com:2195: 2 (stream_socket_client(): 无法设置本地证书链文件`C:\ Users\Dell\la ravel-backend\aps_development.cer'; 检查您的 cafile/capath 设置是否包含您的证书及其颁发者的详细信息)

在 C:\Users\Dell\laravel-backend\vendor\laravel-notification-channels\apn\src\Exceptions\ConnectionFailed.php:16 12| * @return \NotificationChannels\Apn\Exceptions\ConnectionFailed 13| */ 14| 公共静态函数 create($exception) 15| {

16| return new static("无法连接到 APNs: {$exception->getMessage()}", 0, $exception); 17| } 18| } 19|

异常跟踪:

1
NotificationChannels\Apn\Exceptions\ConnectionFailed::create(Object(ZendService\Apple\Exception\RuntimeException)) C:\Users\Dell\laravel-backend\vendor\laravel-notification-channels\apn\src\InteractsWithConnection.php: 32

2 ZendService\Apple\Exception\RuntimeException::("无法连接: tls://gateway.sandbox.push.apple.com:2195: 2 (stream_socket_client(): 无法设置本地证书链文件`C:\Users \Dell\laravel-backend\aps_development .cer'; 检查您的 cafile/capath 设置是否包括您的证书及其颁发者的详细信息)") C:\Users\Dell\laravel-backend\vendor\zendframework\zendservice-apple-apns \src\Apns\Client\AbstractClient.php:113

请使用参数 -v 查看更多详细信息。

请帮忙!我们即将推出我们的应用程序,但只需要能够发送推送通知,我们能够从 ionic cordova 前端生成设备令牌,但没有 laravel 后端能够发送通知,那么我们就可以了一个车辙。

不工作的来源

标签: phpioslaravelsslapple-push-notifications

解决方案


推荐阅读