更新存折钱包无法连接 [英] Update Passbook wallet failed to connect

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

问题描述

我被更新的钱包推送通知所震惊,我使用了下面的代码,服务器未连接错误.

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 -inder der -in aps_development.cer -out certificate.pem
openssl pkcs12 -nocerts -in Certiticates.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

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

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