如何知道“主题"? iOS上Firebase通知中的名称 [英] How to know "topic" name from Firebase notification on iOS

查看:66
本文介绍了如何知道“主题"? iOS上Firebase通知中的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在iOS应用程序中使用Firebase.我成功地集成了它,并从所有三个目标(用户群,主题和单个设备)接收到通知. 我的问题是如何知道从哪个主题接收到特定的通知?

I'm trying to use Firebase in my iOS application. I successfully integrated it and receiving notifications from all 3 Targets (user segment, topic and single device). My question is how to know a particular notification is received from which topic?

我正在关注此文档和此 github页面

我正在iOS11.2(XCode9.2)和更高版本上进行测试我的回应(userInfo)是:

I'm testing on iOS11.2 (XCode9.2) & my response (userInfo) is:

{
    aps =     {
        alert = test;
        sound = default;
    };
    "gcm.message_id" = "0:1513282329413512%38894e8e28894e8e";
    "gcm.n.e" = 1;
    "gcm.notification.sound2" = default;
    "google.c.a.c_id" = 1542306492273623048;
    "google.c.a.c_l" = test;
    "google.c.a.e" = 1;
    "google.c.a.ts" = 1513182256;
    "google.c.a.udt" = 0;
}

我正在获取gcm.message_id,但看起来像"gcm.message_id" = "0:1512894251264950%38894e8e38894e8e"; 如何将其映射到我的主题名称?

I'm getting gcm.message_id but it looks like "gcm.message_id" = "0:1512894251264950%38894e8e38894e8e"; How to map this to my topic name?

谢谢.

推荐答案

我从Firebase支持团队得到了答案.

I got the answer from Firebase support team.

似乎没有一种方法可以按照以下方式获取此信息 文档.我可以想到的一种解决方法是,如果您通过了 数据有效载荷中的主题名称,然后可以从 您的代码并将其映射到您的message_id.

It doesn't seem like there's a way to get this info as per documentation. One workaround I can think of is if you would pass the topic name in your data payload, you can then manually handle it from your code and map it to your message_id.

因此,这似乎可以在Android上使用,但在iOS(今天(2017年12月))上不受支持

So looks like this works on Android but on iOS it's not supported today (Dec 2017)

这篇关于如何知道“主题"? iOS上Firebase通知中的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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