0

我得到了这个例外:

已达到发送通知的最大发送尝试次数!

(仅适用于苹果通知)每天多次并一直阻止通知一段时间,然后它会继续工作。我不确定发生了什么。ServiceException 事件正在捕获此异常。

我正在使用 pushsharp 默认配置。

这是我的代码:

     string result = null;
     try
     {
        push = new PushBroker();
        //Wire up the events
        push.OnNotificationSent += NotificationSent;
        push.OnChannelException += ChannelException;
        push.OnServiceException += ServiceException;
        push.OnNotificationFailed += NotificationFailed;
        push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
        push.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
        push.OnChannelCreated += ChannelCreated;
        push.OnChannelDestroyed += ChannelDestroyed;

        var appleCert = File.ReadAllBytes(apnCert);

        push.RegisterAppleService(new ApplePushChannelSettings(
            apnProduction, appleCert, apnCertPassword));
        LogNotificationForDevice("", "Apple PN registered Successfully", "");

        push.RegisterGcmService(new GcmPushChannelSettings(androidCertToken));
        LogNotificationForDevice("", "Android PN registered Successfully", "");

        var res = new
        {
            status = "Success"
        };
        result = JsonConvert.SerializeObject(res, Formatting.Indented);
    }
    catch (Exception ex)
    {
        var resex = new
        {
            status = "Failure",
            Message = ex.Message
        };
        result = JsonConvert.SerializeObject(resex, Formatting.Indented);

        LogNotificationForDevice("", "Error when trying to initiate the PushBroker", result);
    }

我感谢您的帮助。

4

1 回答 1

0

我使用了这个版本“PushSharp 2.1.2-beta”,我不再遇到这个异常了。

于 2014-04-09T06:48:10.607 回答