Firebase Messaging主题格式错误问题求助
Firebase Cloud Messaging主题条件错误修复方案
核心问题:你误用了
Message类的属性——Topic字段仅支持单个主题名称,多主题的OR/AND条件必须使用Condition字段,而非Topic。错误原因:你把拼接好的多主题条件字符串赋值给了
Topic,这不符合FCM的API规范,导致操作失败。你的条件字符串格式本身是正确的('主题ID' 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 }, // 将条件字符串赋值给Condition字段 Condition = string.Join(" || ", Tags.Select(t => $"'{t}' in topics")) };
内容的提问来源于stack exchange,提问作者Mr.Deer
相关产品推荐
相关产品推荐

