ios - 如何使用 Firebase 通知控制台在 APNS 负载中添加 mutable_content?

标签 ios firebase firebase-cloud-messaging firebase-notifications

无法弄清楚如何在 aps 字典中发送 mutable_content=true。这是我从 firebase 消息控制台发送通知时收到的 json 有效载荷

{
    aps =     {
        alert =         {
            body = "50% off on booking ";
            title = "CompanyName 50% coupon ABC50OFF";
        };
        sound = default;
    };
    "attachment-url" = "https://www.xxxxxxxxx.com/campaign/images_thumb/Toyota-Fortuner-AT.jpg";
    "click_action" = reminder;
    "content_available" = 1;
    "gcm.message_id" = "0:1491225835295720%a84b45aaa84b45aa";
    "gcm.n.e" = 1;
    "gcm.notification.sound2" = default;
    "google.c.a.c_id" = 3829383583613273032;
    "google.c.a.e" = 1;
    "google.c.a.ts" = 1491225835;
    "google.c.a.udt" = 0;
    "mutable_content" = 1;
}

最佳答案

目前无法在使用 Firebase 通知控制台时设置 mutable_content 的值。您必须自己构建有效负载,如下所示:

{
    "to": "<REGISTRATION_TOKEN_HERE>",
    "mutable-content" : true,
    "notification": {
        "body" : "Eureka!",
        "title": "Patient is not doing well",
        "click_action" : "provider-body-panel"
    }
}

然后从您自己的应用服务器发送它。您也可以通过 using Postman 来做到这一点或 cURL

我的回答中的修改部分 here .

关于ios - 如何使用 Firebase 通知控制台在 APNS 负载中添加 mutable_content?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43223560/

相关文章:

android - 开始使用新的 Firebase 网站,我在测试 Android 身份验证示例程序时遇到此错误

Android FCM 错误 FirebaseInstanceId : Error while delivering the message: ServiceIntent not found

android - 从GCM迁移到FCM后的PeriodicTask和OneoffTask

iphone - NSDate 保留发送到释放实例的消息

ios - 如何在 xamarin.ios 中滚动图像上的文本

ios - 如何对优步供应商进行分类?

firebase - 'firebase deploy' 错误 - 必须在每个 "public"配置中使用 "hosting"提供公共(public)目录

android - 发送消息时未注册 Firebase 通知服务

php - 使用 FCM 和 php 推送通知

IOS FMDB 良好实践