更新 Passbook 钱包连接失败 [英] Update Passbook wallet failed to connect

查看:28
本文介绍了更新 Passbook 钱包连接失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对更新钱包推送通知感到震惊,我使用了以下代码,服务器未连接错误.

i'm struck with update wallet push notiifcation,i used bellow code,server not connected error.

我错过了任何凭据.请帮助我解决这个问题.

I missed any credentials.please help to me ,fix this issue.

我注册了我的存折并将pushtoken取回服务器.

I registered my passbook and get back pushtoken to server.

此密钥与存折生成证书密钥相同.

this key same as the passbook generate certificate key.

            $certifile = 'passbook/certificates/AppleWWDRCA.pem'; 
            $passphrase = 'xxxxxxxx';
            $trust ='';
            $url = 'ssl://gateway.push.apple.com:2195';
            $ctx = stream_context_create();
            stream_context_set_option($ctx, 'ssl', 'local_cert', $certifile);
            stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
            $fp = stream_socket_client($url, $err, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx);

            if (!$fp)
                exit("Failed to connect: $err $errstr" . PHP_EOL);
            echo 'Connected to APNS' . PHP_EOL;
            $body['aps'] = array(
                'alert' => $message,
                'sound' => 'default',
                'pushToken'=>'xxxxxxxxxxxxxx',
                 'passTypeId'=>'xxxxxxxxx'

            );

            $payload = json_encode($body);

            $msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;

            $result = fwrite($fp, $msg, strlen($msg));

        // Close the connection to the server
                fclose($fp);

请帮帮我.

已连接到服务器.但我在发送推送通知时出错.

Connected to server.but i have error in sending push notifictaion.

$body['aps'] = array( );
$msg = chr(0) . pack('n', 32) . pack('H*', $pushToken) . pack('n', strlen($payload)) . $payload;

if (!$result)
            echo 'Message not delivered' . PHP_EOL;
        else
            echo 'Message successfully delivered' . PHP_EOL;

消息未送达:10053.

Message not delivered: 10053.

用户预订时间动态传递创建并显示到设备.

user booking time dynamically pass created and display to device.

如果用户修改了预订日期.我需要通过推送通知动态更新预订日期和时间给用户.

if user modify the booking date .I need to update dynamically booking date and time to user pass via pushnotification.

请任何人帮我更新我的存折.

any one please help to me update my passbook.

推荐答案

在此处查看 PHP 代码(第一个答案).这对我有用.PHP Apple 增强型推送通知读取错误响应

check here for PHP code (first answer). It's work for me. PHP Apple Enhanced Push Notification read error response

您使用了错误的认证.您必须通过从钥匙串导出来从您的通行证 (p12) 中制作 pem 文件.

You use the wrong certification. You have to make pem file from your pass certification (p12) by export from keychain.

如何从cer文件制作P12和PEM文件
1.进入保存文件夹
2. 打开终端并 cd 到该文件夹​​
openssl x509 -inform der -in aps_development.cer -out certificate.pem
openssl pkcs12 -nocerts -in Certitiates.p12 -out p12Certificates.pem
[输入 .p12 的密码和 .pem 的密码]
cat certificate.pem p12Certificates.pem > apns_cert.pem

How to make P12 and PEM file from cer file
1. move into save folder
2. open terminal and cd to that folder
openssl x509 -inform der -in aps_development.cer -out certificate.pem
openssl pkcs12 -nocerts -in Certiticates.p12 -out p12Certificates.pem
[type password for .p12 and password for .pem]
cat certificate.pem p12Certificates.pem > apns_cert.pem

这篇关于更新 Passbook 钱包连接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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