简体   繁体   English

Firebase通知无法在iOS上播放声音

[英]Firebase notification not playing sound on iOS

I am using Firebase to send notifications to iOS devices. 我正在使用Firebase将通知发送到iOS设备。 The setup is working fine: notifications are being received on the target devices. 设置工作正常:在目标设备上收到通知。 The problem is that they are silent - no sound is accompanying the notification. 问题在于它们没有声音-通知中没有声音。

When I send a test alert via the FCM console, and enable the sound dropdown, the notification is received with sound. 当我通过FCM控制台发送测试警报并启用声音下拉菜单时,将收到带有声音的通知。

According to https://stackoverflow.com/a/51048292/6002780 I need to specify the sound as "default" within the apns>payload>aps section of the request. 根据https://stackoverflow.com/a/51048292/6002780,我需要在请求的apns> payload> aps部分中将声音指定为“默认”。 I have tried this to no avail. 我尝试了这个都没有用。

According to apple's docs if the sound file cannot be found, or the value is set to default, the default sound will be played. 根据apple的文档,如果找不到声音文件,或者将值设置为default,则将播放默认声音。 This does not appear to be the case with Firebase. Firebase似乎并非如此。

Any ideas on how to get the default notification sound playing? 关于如何播放默认通知声音的任何想法?

Turns out there is a bug in iOS. 事实证明,iOS中存在错误。 For me, I had originally set my app up with an incorrect fcm messaging option for sound. 对于我来说,我最初是使用错误的fcm声音消息传递选项设置我的应用程序的。 This ineffect meant I was sending notifications without sound. 这种影响意味着我发送的通知没有声音。 Once I had corrected this fcm setting issue (using the format as indicated in the referenced link in my question), I still had no sound. 一旦纠正了此fcm设置问题(使用问题中引用的链接中所示的格式),我仍然没有声音。 The fix was to go into the iOS notification settings for my app and toggle “sound” to off then on again. 解决方法是进入我的应用程序的iOS通知设置,然后将“声音”切换为关闭然后再次打开。 Problem solved. 问题解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase推送通知警报声音未在iOS 10的后台模式下播放 - Firebase push notification alert sound is not playing in background mode in iOS 10 自定义通知声音无法播放iOS目标C - Custom notification sound not playing iOS objective c 声音文件未在本地通知iOS7上播放 - Sound file not playing on Local notification iOS7 苹果推送通知iOS 8.1.3上没有声音播放 - No sound playing on apple push notification iOS 8.1.3 自定义声音无法在iOS上播放以进行远程通知 - Custom Sound not playing for remote notification on iOS 自定义通知声音未在 iOS 上播放以用于 react-native-push-notification - Custom Notification Sound Not Playing on iOS for react-native-push-notification 声音未在UILocal通知中播放 - sound not playing in UILocal notification 本地通知声音没有播放? - Local Notification sound not playing? 如何以编程方式配置iOS'远程通知,只是振动不播放声音或播放声音而不振动? - How to programmatically config iOS' remote notification to just vibrating not playing sound or playing sound without vibrating? Cordova Local Notification播放iOS和Android的本地声音 - Cordova Local Notification playing local sound for iOS and Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM