iOS“线程ID"不分组推送通知 [英] iOS "thread-id" doesn't group push notifications

查看:22
本文介绍了iOS“线程ID"不分组推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自

我希望它们在视觉上与其他通知不同......或者当其他通知介于两者之间时组合在一起.在我们的测试中,两者都不是.

我做错了什么?还是我误解了这个功能?

解决方案

遗憾的是,您不能免费获得此服务.您需要创建一个 通知 UI 扩展,并实现您自己的 UI(在这种情况下,它是一个对话 UI),并在 收到新通知时更新 UI线程 ID.

这可能不是正确答案,请在此处查看更全面的答案.

From the documentation:

thread-id | string | When displaying notifications, the system visually groups notifications with the same thread identifier together. For remote notifications, the value of the threadIdentifier property is set to the value of this request header.

Our push notification payloads:

{
    aps =     {
        alert =         {
            body = "Leeroy J asked you: Test Push Notification";
        };
        badge = 12;
        sound = default;
        "thread-id" = 9150;
    };
    n = "6kQ/0x6556";
    r = 9150;
}

{
    aps =     {
        alert =         {
            body = "Leeroy J re: Test Push Notification";
        };
        badge = 13;
        sound = default;
        "thread-id" = 9150;
    };
    n = "6l8/0x6582";
    p = 7197;
    r = 9150;
}

Here's what it looks like in Message Center:

I expected them to be visually different than other notifications... either that or grouped together when other notifications come in between. In our testing, neither is the case.

What am I doing wrong? Or am I misunderstanding this feature?

解决方案

Unfortunately, you don't get this for free. You need to create a Notifictation UI extension, and implement your own UI(in this case it's a conversation UI), and update the UI when receive new notification with same thread-id.

Edit: this may not be the correct answer, see a more comprehensive answer here.

这篇关于iOS“线程ID"不分组推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆