我遇到了同样的问题。我不是IOS开发人员,但我是c#开发人员。 iOS开发人员给了我配置文件,以便在我们运行的Windows服务中发送推送通知。我用我的iPad测试了PushSharp并且没有用。我收到了错误消息:
推送通知失败:PushSharp.Core.MaxSendAttemptsReachedException:已达到发送通知的最大发送尝试次数!
我在本地和服务器上尝试了这个,我只是尝试发送1次。
代码。
var appleCertificate =
File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "sb_push.p12"));
var push = new PushBroker();
/* push.OnNotificationSent += NotificationSent;
push.OnChannelException += ChannelException;
push.OnServiceException += ServiceException;
push.OnNotificationFailed += NotificationFailed;
push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
push.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
push.OnChannelCreated += ChannelCreated;
push.OnChannelDestroyed += ChannelDestroyed;
push.OnNotificationSent += NotificationSent;*/
push.OnNotificationFailed += NotificationFailed;
push.RegisterAppleService(new ApplePushChannelSettings(appleCertificate, "PASSWORD!"));
push.QueueNotification(new AppleNotification()
.ForDeviceToken(deviceToken)
.WithAlert(message)
.WithSound("default"));
答案 0 :(得分:1)
我也在使用Windows服务器,我能够解决这个问题。请参阅“PushSharp ApplePushService giving a Channel Exception”和“Processing multiple Notifications with PushSharp for ios and android”。两者都通过重新生成我的证书得到解决。