FCM Notification in iOS doesn#39;t play sound when received(iOS 中的 FCM 通知在收到时不播放声音)
问题描述
我在我的 iOS 应用程序中使用 Firebase 推送通知.虽然我可以通过发送以下有效负载来发送通知,但收到时它不会播放声音.
I am using Firebase push notifications in my iOS Application. Although I am able to send the notification by sending below payload, it doesn't play a sound when received.
{
"to": "myToken",
"notification": {
"body": "test",
"title": "test"
},
"priority": "high"
"sound": "default"
}
如果我从控制台发送测试消息,它运行良好并播放通知声音.
注意:
If I send the test message from console, it works well and plays notification sound.
Note:
- 我的授权码是正确的
- 我正在向
https://fcm.googleapis.com/fcm/send 发送 http 请求 - 我在 iPhone 4、iPhone 6 和 iPhone 6S 上测试过,都收到了无声通知
推荐答案
你的 JSON "sound" : "default" 应该在 "notification" 键内JSON 的根.这个 JSON 应该可以工作.
your JSON "sound" : "default" should be inside the "notification" key not in the root of the JSON. This JSON should work.
{
"to": "myToken",
"notification": {
"body": "test",
"title": "test",
"sound": "default"
},
"priority": "high"
}
这篇关于iOS 中的 FCM 通知在收到时不播放声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iOS 中的 FCM 通知在收到时不播放声音
基础教程推荐
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
