7
我有一个简单的代码:PushSharp不发送通知
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);
我尝试用分别用沙箱的研发和生产sertificates和生产服务器。但没有发生。客户端能够获得推送通知。 有什么问题?提前致谢。
更新:
我订阅的事件。
OnNotificationFailed说我这个错误:
{APNS NotificationFailureException -> 5 : Invalid token size -> {"aps":{"badge":1}}}
如果我总结我的设备令牌到< ...>我收到另一个错误:
{APNS NotificationFailureException -> 8 : Invalid token -> {"aps":{"badge":1}}}
非常感谢。 – Neshta
不客气! – Eran
它为我工作。 “空间”是我的问题。 – Raghav