【问题标题】:I've got some issues while trying to send messages to multiple iPhones我在尝试向多部 iPhone 发送消息时遇到了一些问题
【发布时间】:2019-11-20 20:43:29
【问题描述】:

我正在尝试将PushNotification 发送到多个设备。

1.我在苹果网站developeraccount中添加了手机IdentifierDevices

2.我在Visual Studio中下载了Provisioning Profile(我正在连接mac mini的windows上开发)

3.我启动了项目(简单的推送通知,机器人出错时只接收消息并发送给客户端),在iPhone上下载成功。

4.我测试了它,我们都收到了消息(最初我只是用手机发短信),过了一会儿我再次尝试发送消息,但第二部手机只收到了它。我不知道问题出在哪里。我读到Notification Hub 支持 10 个测试设备。

有什么建议吗?

感谢您花时间阅读我的问题!

【问题讨论】:

  • 嗨 Zdravko,您是否在仪表板上看到任何 APNS 错误?两个 iOS 设备都是 iOS 10(或更高版本)吗?
  • 完全没有错误,两台设备都是 thah 10 以后的版本。

标签: c# ios azure azure-notificationhub


【解决方案1】:

发送通知时,请确保您设置了过期时间。默认值为零。因此,APNs 将通知视为立即过期,并且不会存储通知或尝试重新发送通知。

https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html

apns-expiration

如果此值非零,APNs 会存储通知并尝试至少发送一次,如果第一次无法发送通知,则根据需要重复尝试。如果值为 0,APNs 会将通知视为立即过期,并且不会存储通知或尝试重新发送通知。

var notification = new TemplateNotification(new Dictionary<string, string>()
{
 {"APNS_Expiry", DateTime.UtcNow.AddMinutes(10).ToString("o") }, //Timestamp
                        {"body", NotificationText},
                        {"payload", NotificationText},
                        {"deeplinking", payload},
                    }); 
            var Responsehub = hub.SendNotificationAsync(notification);

也可以参考下面的文档来解决问题。

https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-push-notification-fixer

希望对你有帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-07
    • 1970-01-01
    • 1970-01-01
    • 2020-11-07
    • 2019-03-05
    • 2020-12-24
    • 1970-01-01
    相关资源
    最近更新 更多