在php simplepush.php中在终端中运行PHP时无法获得这些错误
Warning: stream_socket_client(): Unable to set private key file `/users/accenture/Desktop/newAPNS/ck.pem' in /users/accenture/Desktop/newAPNS/simplepush.php on line 22
Warning: stream_socket_client(): failed to create an SSL handle in /users/accenture/Desktop/newAPNS/simplepush.php on line 22
Warning: stream_socket_client(): Failed to enable crypto in /users/accenture/Desktop/newAPNS/simplepush.php on line 22
Warning: stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /users/accenture/Desktop/newAPNS/simplepush.php on line 22
Failed to connect: 0
Run Code Online (Sandbox Code Playgroud)
我使用raywenderlich文章创建了所有证书和pem文件,http: //www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1#comments
kum*_*mar 64
问题是pem文件不正确,我使用http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1创建了pem文件.创建p12文件和使用p12创建pem文件对我来说不起作用.正确创建p12和使用p12创建pem文件的过程如下所示
从Apple获得应用程序的证书后,将您的密钥和Apple证书导出为p12文件.以下是有关如何执行此操作的快速演练:
现在将p12文件转换为pem文件:
$ openssl pkcs12 -in cert.p12 -out apple_push_notification_production.pem -nodes -clcerts
这对我有用,现在我收到推送通知.
在http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1中将密钥文件转换为pem推荐给我带来了问题.
运行
openssl pkcs12 -in keyname.p12 -out keyname.pem -nodes -clcerts
Run Code Online (Sandbox Code Playgroud)
而不是
openssl pkcs12 -nocerts -out keyname.pem -in keyname.p12
Run Code Online (Sandbox Code Playgroud)
解决了我的问题.
| 归档时间: |
|
| 查看次数: |
19996 次 |
| 最近记录: |