gpt4 book ai didi

c# - PushSharp 错误消息发送 IOS 推送通知

转载 作者:行者123 更新时间:2023-11-29 13:09:56 25 4
gpt4 key购买 nike

我遇到了同样的问题。我不是 IOS 开发人员,但我是 c# 开发人员。 iOS 开发人员给了我配置文件,以便在我们运行的 Windows 服务中发送推送通知。我只用我的 iPad 测试了 PushSharp,但它没有用。我收到了错误信息:

Push Notification Fail: PushSharp.Core.MaxSendAttemptsReachedException: The maximum number of Send attempts to send the notification was reached!

我已经在本地和服务器上试过了,我只是想发送 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 服务器,我能够解决这个问题。请参见“PushSharp ApplePushService giving a Channel Exception”和“Processing multiple Notifications with PushSharp for ios and android”。两者都通过重新生成我的证书得到解决。

关于c# - PushSharp 错误消息发送 IOS 推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17635537/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com