繁体   English   中英

Firebase 消息传递错误:主题格式错误

[英]Firebase messaging error: Topic is malformed

一段时间以来,我一直面临 firebase 主题的格式错误,在 firebase 消息中。

当我尝试创建 firebase 推送通知并添加主题条件时,它失败了。

我找不到其他问题来解决我的问题。

我一直在关注这个文档

这是我的主题字符串示例: "'165' in topics || '16' in topics || '166' in topics || '15' in topics || '7' in topics"

我不确定那里可能有什么问题。

这是我的消息构造代码:

 new Message()
    {
        Data = new Dictionary<string, string>
        {
          
            ["Sound"] = SoundName, 
            ["UseSound"] = string.IsNullOrWhiteSpace(SoundName) ? "false" : "true",

        },
        Notification = new Notification
        {
            Title = $"{Interest.ToTitleCase()}Update",
            Body = Title
        },
        // Next line I think, its where the error is.
        Topic = string.Join(" || ", Tags.Select(t => $"'{t}' in topics")) 
    };

一天后,我突然更加注意了,发现为了得到一个条件工作者,我应该使用Condition属性而不是Topic

new Message()
    {
        Data = new Dictionary<string, string>
    {
      
        ["Sound"] = SoundName, 
        ["UseSound"] = string.IsNullOrWhiteSpace(SoundName) ? "false" : "true",

    },
    Notification = new Notification
    {
        Title = $"{Interest.ToTitleCase()}Update",
        Body = Title
    },
    // Condition instead of Topic.
    Condition = string.Join(" || ", Tags.Select(t => $"'{t}' in topics")) 
};

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM