这在 iOS 15 之前运行良好
let center = UNUserNotificationCenter.current()
let content = UNMutableNotificationContent()
content.sound = UNNotificationSound.init(named:UNNotificationSoundName(rawValue: sound))
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)
center.add(request)
用户收到通知声音,iOS 15 之后我必须添加
content.body = "Hello iOS 15"
无论如何,只能在 iOS 15 上发送带有声音的本地通知?
更深入地研究这一点,我们遇到了同样的问题。据我所知,iOS 15 不会发送“空白”通知,不确定这是一个“错误”还是有意为之,我找不到任何相关文档。我们最终使用 AudioServicesPlaySystemSound 来代替我们的特定用例。不确定这是否对您有帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)