首页 文章

如何确保iOS应用程序实例保持订阅FCM主题?

提问于
浏览
0

1 Are FCM token and Instance Id one and the same?

在我的下一个问题中,我认为没有 .

2. Is it possible to register an app instance ID twice to the same topic?

FCM令牌和实例ID过期并刷新 .

3. Do we need to subscribe to a topic again after a token refresh?

我想我们这样做 .

4. Should we listen to a FCM token refresh or to an Instance Id refresh?


我很困惑,因为注册到主题的Firebase iOS API是:

[[FIRMessaging messaging] subscribeToTopic:@"news"]

没有明确涉及哪个令牌 . 我的猜测是内部逻辑使用Instance Id,因为服务器API endpoints 是 https://iid.googleapis.com/iid/v1/IID_TOKEN/rel/topics/TOPIC_NAME

但是,Firebase文档仅提及FCM令牌刷新以及如何监控它们 .

1 回答

  • 1
    • InstanceID和令牌不同 . 请参阅我的答案here中的InstanceID说明,以及我的答案here中对令牌的一般说明 .

    通常,令牌(打印时)也包含InstanceID . 它可能是Google选择的格式,以确保令牌是唯一的,或将其连接到特定设备 . 我不能肯定地说 .

    • 您无法复制订阅 . 每当刷新令牌时,新令牌都会保留相应的订阅 .

    • 否 . 见#2 .

    • 它使用令牌 . InstanceID只是应用程序实例的ID . 令牌是FCM发送消息所需的内容 .

相关问题