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