C# PushSharp不';不要发送通知

C# PushSharp不';不要发送通知,c#,push-notification,apple-push-notifications,pushsharp,C#,Push Notification,Apple Push Notifications,Pushsharp,我有一个简单的代码: PushBroker pushBroker = new PushBroker(); string path = HttpContext.Current.Server.MapPath("~/" + AppSettings.CertificatePath); var appleCert = File.ReadAllBytes(path); pushBroker.RegisterAppleService( new ApplePushChann

我有一个简单的代码:

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);
如果我将设备令牌包装到中,则会收到另一个错误:

{APNS NotificationFailureException -> 8 : Invalid token -> {"aps":{"badge":1}}}

您的设备令牌不应包含任何空格和“”字符。它应该包含64个十六进制字符。如果没有,这就解释了第一个错误(无效的令牌大小)

i、 e, 不是
也不是
3948de8f 3948de8f…

仅限
3948de8f3948de8f…


第二个错误(无效令牌)可能意味着您使用沙盒设备令牌推送到生产APNS服务器,反之亦然。沙盒令牌只能在沙盒环境中使用

这对我有用。“空间”是我的问题。谢谢,它对我很有用。Sanbox设备令牌是meYOU的问题长官。。。刚刚结束了我漫长的一天!非常感谢你。
{APNS NotificationFailureException -> 8 : Invalid token -> {"aps":{"badge":1}}}