Laravel 推送通知:证书不存在
Laravel push notifications: certificate doesn't exist
我正在尝试将 Laravel
中的推送通知发送到 iOS
应用程序,我正在使用 Laravel 的 Push Notification Package。这是我的配置文件:
return array(
'appNameIOS' => array(
'environment' => 'development',
'certificate' => base_path('app/cert/APNS_Cert_Hasalty_dev.p12'),
//I am using absolute path in the actual code
'passPhrase' => '',
'service' => 'apns'
),
'appNameAndroid' => array(
'environment' => 'production',
'apiKey' => 'yourAPIKey',
'service' => 'gcm'
)
);
这是我发送通知的方式:
$payload = PushNotification::Message('Hello World, i`m a push message from hasalty', array(
'badge' => 1,
'sound' => 'default',
));
PushNotification::app('appNameIOS')
->to($deviceToken)
->send($payload);
现在,证书文件存在于配置中给定的路径中,但它向我抛出错误:
Certificate
app/cert/APNS_Cert_Hasalty_dev.p12
does not exist
我做错了什么?有什么帮助吗?
Laravel 的版本是 5.3.31
.
试试这个,改用绝对路径。 __DIR__
.'/path/to/certificate.pem'
我明白了。事实上,我正在使用 .p12
文件并将其更改为 .pem
文件并且它起作用了。区别b/w这些可以研究here.
我正在尝试将 Laravel
中的推送通知发送到 iOS
应用程序,我正在使用 Laravel 的 Push Notification Package。这是我的配置文件:
return array(
'appNameIOS' => array(
'environment' => 'development',
'certificate' => base_path('app/cert/APNS_Cert_Hasalty_dev.p12'),
//I am using absolute path in the actual code
'passPhrase' => '',
'service' => 'apns'
),
'appNameAndroid' => array(
'environment' => 'production',
'apiKey' => 'yourAPIKey',
'service' => 'gcm'
)
);
这是我发送通知的方式:
$payload = PushNotification::Message('Hello World, i`m a push message from hasalty', array(
'badge' => 1,
'sound' => 'default',
));
PushNotification::app('appNameIOS')
->to($deviceToken)
->send($payload);
现在,证书文件存在于配置中给定的路径中,但它向我抛出错误:
Certificate app/cert/APNS_Cert_Hasalty_dev.p12 does not exist
我做错了什么?有什么帮助吗?
Laravel 的版本是 5.3.31
.
试试这个,改用绝对路径。 __DIR__
.'/path/to/certificate.pem'
我明白了。事实上,我正在使用 .p12
文件并将其更改为 .pem
文件并且它起作用了。区别b/w这些可以研究here.