Firebase Cloud Messaging iOS(与GCM服务器兼容,主题) [英] Firebase Cloud Messaging iOS (compatibility with GCM server, topics)

查看:88
本文介绍了Firebase Cloud Messaging iOS(与GCM服务器兼容,主题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 iOS 上实现一个应用程序,主要目的是处理从服务器收到的推送通知。服务器正在使用 GCM 进行消息传递。


  1. 如果我决定在iOS上使用 FCM 框架(甚至没有确定,只是没有找到Swift 3的GCM框架,也没有找到Cocoapods的框架),它与现有的 GCM - 是否有必要 将其迁移到FCM

  2. 可以接收数据信息(不是通知 - 工作应该) 申请已终止。当应用程序处于后台或前台时,委托方法正在被调用并且数据按照它们应该被处理,但是当它终止时 - 只有在用户触摸通知弹出窗口时才会调用,但是我需要从数据消息中填充数据即使应用程序已关闭,也可以访问数据库。 如何确定 主题该消息是否已发送?
    我需要的原因是我必须根据收到的消息发送到哪个主题来执行不同的操作。我知道在Android上,从中收到了JSON中的一个关键字,但iOS呢?

    谢谢。

    解决方案


    1. 全部GCM功能与FCM兼容(相同的标记,主题等)。

      新的FCM功能可能不适用于GCM。


    2. 如果应用程序已终止,则iOS上无法接收数据消息(因为它未在应用程序切换器菜单中列出)。这是iOS强加的限制。现在我建议添加(复制)有关您在哪些数据有效载荷中定位哪个主题的信息消息



    I'm implementing an application on iOS which main purpose is to handle push notifications received from the server. Server is using GCM for messages delivery.

    1. If I decided to use the FCM framework on iOS (not even decided, just haven't found GCM framework for Swift 3, nor on Cocoapods), how much compatible will it be with the existing GCM - is it necessary to migrate it to FCM?

    2. Is it possible to receive data messages (not notifications - the work as the should) while application is terminated. While application is in the background or foreground, the delegate method is being invoked and data are handled as they should, but when it is terminated - nothing is invoked, only if user touches the notification popup, but I need to fill data from data message to the database even when app is closed.

    3. How to determine the topic to which the message was sent? The reason I need this is that I have to make different actions based on to what topic/s the received message was sent to. I know that on Android, there is a key in received JSON - from, but what about iOS?

    Thank you.

    解决方案

    1. All the GCM features are compatibile with FCM (same token, topics etc).
      New FCM features might not be available in GCM.

    2. On iOS is not possible to receive data-messages if the application is terminated (as in it's not listed in the app switcher menu). This is a limitation imposed by iOS.

    3. for now I suggest to add (replicate) the information about which topic you are targeting in the the data payload of the message

    这篇关于Firebase Cloud Messaging iOS(与GCM服务器兼容,主题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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