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

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

问题描述

我试图用本地MAC机上运行,​​但去以下错误

 警告:在stream_socket_client()[function.stream插槽客户端]:无法设置专用密钥文件`/Applications/XAMPP/xamppfiles/htdocs/apns/apns-dev.pem 在/Applications/XAMPP/xamppfiles/htdocs/apns/apns.php第9行警告:在stream_socket_client()[function.stream插槽客户端]:未能在/Applications/XAMPP/xamppfiles/htdocs/apns/apns.php第9行创建一个SSL手柄警告:在stream_socket_client()[function.stream插槽客户端]:失败,使加密在/Applications/XAMPP/xamppfiles/htdocs/apns/apns.php第9行警告:在stream_socket_client()[function.stream插槽客户端]:无法连接到SSL://gateway.sandbox.push.apple.com:2195(未知错误)/应用程序/ XAMPP / xamppfiles / htdocs中/ APNS / apns.php第9行警告:socket_close()预计参数1是资源,布尔线11 /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php给出警告:FCLOSE()预计参数1是资源,布尔线12 /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php给出

我PEM认证从其他机器生成的,

所以,我完全糊涂了什么,我现在要做的。

请让我知道我需要做的在本地主机运行


解决方案

我认为你可能已经导出的证书,但不能从.cer文件的私钥,苹果用品。

从markbates这些指令可能会助阵:


  

一旦你从证书
  苹果的申请,出口
  你的密钥和苹果证书
  P12文件。这里是一个快速演练
  如何做到这一点:


  
  

      
  1. 单击旁边的箭头披露在钥匙串访问您的证书
      并选择证书和
      键。

  2.   
  3. 右键单击并选择导出2项...

  4.   
  5. 选择从下拉P12格式,并将其命名为 cert.p12

  6.   

  
  

现在的隐蔽P12文件到PEM文件:


  $的openssl的pkcs12 -in cert.p12退房手续apple_push_notification_production.pem -nodes -clcerts

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

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

解决方案

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

These instructions from markbates might help out:

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. Click the disclosure arrow next to your certificate in Keychain Access and select the certificate and the key.
  2. Right click and choose Export 2 items….
  3. Choose the p12 format from the drop down and name it cert.p12.

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天全站免登陆