使用pushsharp发送存折更新 [英] sending passbook update with pushsharp

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

问题描述

我正在尝试测试与Apple的推送通知沙箱服务器的通信.

I'm trying to test talking to apple's push notification sandbox server.

我按照此链接 (已启用推送通知,请求的证书授权,上载,生成的证书,导出p12)

I made a certificate following this link (enabled push notification, requested certificate authority, uploaded, generated cert, export p12)

我制作了一个示例C#控制台应用程序,看起来像下面的

I made a sample C# console application that looks like the following

PushBroker push = new PushBroker();

var appleCert = File.ReadAllBytes(@"devapns.p12");
push.OnNotificationSent += NotificationSent;
push.OnChannelException += ChannelException;
push.OnServiceException += ServiceException;
push.OnNotificationFailed += NotificationFailed;
push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
push.OnChannelCreated += ChannelCreated;
push.OnChannelDestroyed += ChannelDestroyed;

push.RegisterAppleService(new ApplePushChannelSettings(false,appleCert,"password"));

push.QueueNotification(new AppleNotification()
                           .ForDeviceToken(token)
                            .WithPasskitUpdate());



 push.StopAllServices(waitForQueuesToFinish: true);

当我跑步时我会得到

已达到最大发送尝试次数

The maximum number of Send attempts was reached

我当前使用的PushSharp版本是2.2.1.0

The version of PushSharp I'm currently using is 2.2.1.0

还有其他需要做的事情吗?我需要在某处启用SSL吗?我的证书未正确安装在本地计算机上吗?我不确定我要去哪里.

Is there something else I need to do? Do I need to enable SSL somewhere? Is my certificate not properly installed on my local machine. I'm not sure where I am going wrong.

注意:p12文件约为3KB

NOTE: the p12 file is about 3KB

我在本地计算机上安装了开发证书,只是为了在运行此控制台应用程序时进行测试

I installed the development certificate on my local computer just for testing when running this console application

更新:

我设法将通知成功发送到apns.但是,唯一的问题是通行证不会在用户设备上更新.根据此链接,我的网络服务是在从APNS接收到存折更新通知后,获取设备调用一次的有效序列号列表.但是,这永远不会发生.

I managed to get notifications successfully being sent to apns. However, the only problem is that passes do not update on the user device. According to this link, my webservice is to get a list of valid serial numbers once invoked by the device after receiving a passbook update notification from APNS. However, this never happens.

似乎我可以成功地将通知发送到Apple Notification Service,但是apn无法从那里将通知发送到设备.有什么想法吗?

It seems as if I can successfully send my notification to the Apple Notification Service, but from there the apns cannot send it to the device. Any thoughts?

现在,我正在对通行证进行签名,并使用相同的通行证类型ID证书向APNS发送通知.

Right now I am signing the pass and sending a notification to APNS using the same pass type ID certificate.

推荐答案

所以我终于能够使用APNS更新存折中的通行证.这是一个艰巨的过程,我没有考虑很多不同的事情.这里有几件事要牢记.

So I was finally able to update a pass in passbook using APNS. It was an arduous process and there were many different things I didn't take into account. Here are a couple things to keep in mind.

  1. 在签署通行证和使用pushsharp时,请确保使用相同的.p12文件. (我最初使用的是与常规推送通知相关的其他.p12).因此,我最初在问题中发布的链接有点误导性,您可以按照这些步骤进行常规的推送通知.但是对于存折通知,您需要使用与您的通行证类型ID关联的.p12文件

  1. Be sure you use the same .p12 file when signing the pass and using pushsharp. (I had originally used a different .p12 associated with regular push notifications). So the link I originally posted in the question is a tad bit misleading, you would follow those steps for regular push notifications. But for passbook notifications, you need use the .p12 file associated with your Pass Type ID

在PushSharp中,请确保禁用生产/沙盒证书检查.存折没有沙盒环境,因此所有内容都应指向生产环境.在此行中,添加一个额外的true参数以禁用该检查

In PushSharp, be sure to disable the production/sandbox certificate check. There is no sandbox environment for passbook, so everything should point to production. In this line, add an extra true parameter to disable the check

push.RegisterAppleService(new ApplePushChannelSettings(false,appleCert,"password", true));

确保在测试时未使用测试设备.您也不能使用模拟器

Be sure you aren't using a test device when testing. Also you cannot use the simulator

您收到的推送令牌不同于注册常规推送通知时将收到的DeviceIDToken.推送令牌是存折专用的

The push token you receive is different than the DeviceIDToken you would receive when registering for regular push notifications. The push token is passbook exclusive

确保在服务器上安装了正确的证书.例如,我必须安装通过类型ID证书

Ensure the proper certificates are installed on your server. For example I had to install the pass type ID certificate

执行telnet feedback.push.apple.com 2196以确保您可以访问apns服务器

Do a telnet feedback.push.apple.com 2196 to ensure you can hit the apns server

这篇关于使用pushsharp发送存折更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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