苹果推送通知服务 [英] Apple Push Notification Service

查看:36
本文介绍了苹果推送通知服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用本地 mac 机器运行但出现以下错误

i tried to run using local mac machine but go the following errors

Warning: stream_socket_client() [function.stream-socket-client]: Unable to set private key file `/Applications/XAMPP/xamppfiles/htdocs/apns/apns-dev.pem’ in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 9

Warning: stream_socket_client() [function.stream-socket-client]: failed to create an SSL handle in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 9

Warning: stream_socket_client() [function.stream-socket-client]: Failed to enable crypto in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 9

Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 9

Warning: socket_close() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 11

Warning: fclose() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 12

我获得了从其他机器生成的 PEM 证书,

I got PEM certificated generated from other machine,

所以我完全困惑我现在必须做什么.

So I am totally confused what I have to do now.

请让我知道我需要做什么才能在本地主机中运行它

Please let me know what I need to do to run it in localhost

推荐答案

我认为您可能导出了证书,但没有从 Apple 提供的 .cer 文件中导出私钥.

I think that you may have exported the certificate, but not the private key from the .cer file that apple supplies.

markbates 的这些说明可能会有所帮助:

These instructions from markbates might help out:

一旦您获得了来自Apple 为您的应用程序,导出您的密钥和苹果证书作为p12 文件.这是一个快速演练关于如何做到这一点:

Once you have the certificate from Apple for your application, export your key and the apple certificate as p12 files. Here is a quick walkthrough on how to do this:

  1. 在钥匙串访问中单击您的证书旁边的披露箭头并选择证书和钥匙.
  2. 右键单击并选择Export 2 items….
  3. 从下拉列表中选择 p12 格式并将其命名为 cert.p12.

现在将 p12 文件转换为 pem 文件:

Now covert the p12 file to a pem file:

$ openssl pkcs12 -in cert.p12 -out apple_push_notification_production.pem -nodes -clcerts

这篇关于苹果推送通知服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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