3

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

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

这是我发送通知的代码片段:

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 仪表板的屏幕截图:

Azure 监视器 谢谢约翰

4

1 回答 1

0

检查已知问题,在大多数情况下,它来自流动:

  1. https://stackoverflow.com/a/27806476/2379216
  2. https://stackoverflow.com/a/27492124/2379216
  3. https://stackoverflow.com/a/6496604/2379216
于 2015-02-17T18:50:31.810 回答