【问题标题】:Azure Notification Hubs randomly not delivering to IOSAzure 通知中心随机不传送到 IOS
【发布时间】:2015-04-17 22:43:56
【问题描述】:

我正在使用 Azure 通知中心将通知推送到当前安装在 IOS 上的 Phonegap 应用程序。我也会发送到 Android 设备,但目前我的问题只是关于 IOS。

我的问题是消息有时无法传递。如果我要连续多次发送相同的通知,那么它可能只会发送 50% 的时间。

这是我发送通知的代码 sn-p:

private async Task SendNotificationTemplate(string message, string title = null, int? badgeCount = null, string pageId = null, int? itemId = null, IList<string> tags = null)
    {
        var hub = creatHubClient();
        var notification = new Dictionary<string, string>();

        if (string.IsNullOrEmpty(message))
            throw new InvalidDataException("The message field is required for a notification");

        notification.Add("message", message);

        if (!string.IsNullOrEmpty(title))
            notification.Add("alert_title", title);

        if (!badgeCount.HasValue)
            badgeCount = 1;

        notification.Add("badge_number", badgeCount.ToString());

        notification.Add("page_id", !string.IsNullOrEmpty(pageId) ? pageId : string.Empty);

        notification.Add("id", itemId.HasValue ? itemId.ToString() : "0");

        if (tags == null || tags.Count == 0)
        {
            var result = await hub.SendTemplateNotificationAsync(notification);
            if (result.Success!=0)
            {
                _logger.Error("An error occurred when attempting to send a push notification:" + string.Join(",",result.Results.Select(r=>r.Outcome)));
            }
        }
        else
        {
            var result = await hub.SendTemplateNotificationAsync(notification,tags);
            if (result.Success != 0)
            {
                _logger.Error("An error occurred when attempting to send a push notification:" + string.Join(",", result.Results.Select(r => r.Outcome)));
            }
        }

    }

在仪表板监视器中有一些 APNS 错误,但我怎样才能找出这些错误?

我很感激任何帮助或建议,因为这里的不一致让我有点生气。我知道推送通知不能保证会送达,但 Apple 提供的送达率肯定比我得到的要好。我知道我的客户不会像现在这样接受它!

这是 Azure Notification Hub Monitor 仪表板的屏幕截图:

谢谢 约翰

【问题讨论】:

    标签: c# phonegap-pushplugin azure-notificationhub


    【解决方案1】:

    【讨论】:

    • 谢谢,但没有一个是适用的,或者如果他们是我已经尝试过建议的,它仍然是一样的
    • 那么您能否提供有关您在仪表板上看到的 APNS 错误的信息?
    • Azure 没有提供任何信息 - 它只是说给出了 APNS 错误的数量,这对我来说绝对没用。如果我知道这个错误,我就能解决这个问题!
    • 进入监控选项卡,点击页面底部的+添加指标,选择APNS选项卡,勾选所有复选框。
    • 我明白了...看起来有点奇怪。我想看看我们的日志,为了得到它,我需要命名空间名称、集线器名称和执行发送操作的时间。如果您没有时间,请尝试再次重现该问题以解决该问题。如果由于某些原因您不想在此处分享信息,您可以通过 anefimov@microsoft.com 将其通过电子邮件发送给我
    猜你喜欢
    • 2021-06-01
    • 2021-08-03
    • 2018-01-20
    • 2016-07-22
    • 1970-01-01
    • 2015-12-11
    • 2018-05-06
    • 2022-01-12
    • 1970-01-01
    相关资源
    最近更新 更多