【问题标题】:FCM iOS notification with different bundleId and APNS key具有不同 bundleId 和 APNS 密钥的 FCM iOS 通知
【发布时间】:2021-08-30 05:50:51
【问题描述】:

我正在尝试通过 FCM 发送推送通知。我有 2 个应用程序用于一个项目(客户和司机)。我已将它们添加到同一个 Firebase 项目中

我在 Apple 帐户中使用 APNS 密钥,因此我在 firebase 项目中使用了相同的 TeamId 和 APNS 密钥。现在的问题是如何将推送发送到每个应用程序?如何在 FCM 中指定应用程序,我们可以在“主题”或其他键中指定 bundleId 吗? 我目前正在使用 cURL 和 Postman 进行检查,您可以为此提供答案或在 Node 端提供答案

如果我们使用 node-apn,我们可以在“topic”键中指定 bundleId,它也要求 KeyId/TeamId。

【问题讨论】:

    标签: ios firebase firebase-cloud-messaging apple-push-notifications


    【解决方案1】:

    其实你不需要分离应用。当您在任何项目下添加新应用时,Firebase 会管理所有内容,您必须下载 GoogleService-Info.plist 文件并添加到您的项目中。对于每个单独的项目,都有不同的GoogleService-Info.plist,并且该文件与您的 xcode 项目一起配置并为每个设备生成 FCM 令牌。

    您可以使用POST 方法测试来自邮递员的通知

    https://fcm.googleapis.com/fcm/send

    标题

    Content-Type:application/json
    Authorization:key=AAAAueCg8bE.......YOUR FIREBASE KEY
    

    有效载荷

    {
       "notification": {
          "category": "myNotificationCategory",
           "title": "Ticket Confirm",
           "subtitle": "Rajkot",
           "body": "Testing iOS App Notification",
           "mutable-content" : 1,
           "attachments": "www.google.com",
           "sound" : "default"
       },
       "registration_ids": [
           "YOUR FCM TOKEN"
       ]
    }
    

    如果您的回复成功,您会收到message_id 回复。就是这样。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-07
      • 2016-11-05
      • 2019-04-16
      相关资源
      最近更新 更多