【发布时间】:2014-06-09 13:07:18
【问题描述】:
我有一个简单的代码:
PushBroker pushBroker = new PushBroker();
string path = HttpContext.Current.Server.MapPath("~/" + AppSettings.CertificatePath);
var appleCert = File.ReadAllBytes(path);
pushBroker.RegisterAppleService(
new ApplePushChannelSettings(AppSettings.IsProductionPushNotificationServer,
appleCert,
AppSettings.CertificatePassword));
var notification = new AppleNotification().ForDeviceToken(deviceToken.TrimStart('<').TrimEnd('>'))
.WithBadge(unviewedInvitationCount);
pushBroker.QueueNotification(notification);
我尝试将开发和生产证书分别用于沙盒和生产服务器。但是什么也没发生。客户端能够获得推送通知。 怎么了?提前致谢。
更新:
我订阅了这些活动。
OnNotificationFailed 告诉我这个错误:
{APNS NotificationFailureException -> 5 : Invalid token size -> {"aps":{"badge":1}}}
如果我将我的设备令牌包装到 <...> 我会收到另一个错误:
{APNS NotificationFailureException -> 8 : Invalid token -> {"aps":{"badge":1}}}
【问题讨论】:
标签: c# push-notification apple-push-notifications pushsharp