播放提醒声SwiftUI [英] Play reminder sound SwiftUI

查看:90
本文介绍了播放提醒声SwiftUI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解自己可以从自己的音乐库中播放声音,例如:如何使用Swift播放声音?

I understand I can play a sound from my own library, like: How to play a sound using Swift?

但是我该如何使用iPhone已有的默认提醒警报声音呢?只是通过简单的按钮将其置于上下文中?

But how can I use the already existing default Reminder Alerts sounds that iPhone has? Just to put it into context in a simple button press?

谢谢

推荐答案

尝试一下:

import AVFoundation

AudioServicesPlaySystemSound(1026)

其中1026是SystemSound ID.

where the number 1026 is the SystemSound id.

这篇关于播放提醒声SwiftUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆