我有同样的问题。我不是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"));

最佳答案

我也正在使用Windows Server,因此能够解决此问题。请参见“PushSharp ApplePushService giving a Channel Exception”和“Processing multiple Notifications with PushSharp for ios and android”。都通过重新生成我的证书解决了。

09-25 17:29