Push sharp - 达到最大发送尝试次数

时间:2014-03-27 22:13:20

标签: c# pushsharp

我得到了这个例外:

  

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

(仅限苹果通知)每天多次并在一段时间内阻止通知,然后继续工作。我不确定发生了什么。 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);
    }

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

我使用的是这个版本" PushSharp 2.1.2-beta"我再也没有得到这个例外。