播放类似
的系统声音代码var aSound:SystemSoundID = 1057
if let soundURL = Bundle.main.url(forResource: "ios_7_bamboo", withExtension: "mp3") {
AudioServicesCreateSystemSoundID(soundURL as CFURL, &aSound)
print("Initialised aSound:\(aSound)")
} else {
print("You have forgotten to add your sound file to the app.")
}
AudioServicesPlaySystemSound(aSound)
AudioServicesPlayAlertSound(1520)
点击按钮时使用此代码,我会播放声音 在静音状态下在iPhone 7,6中运行,您听不到声音 但是在iPhone x中,如果我将声音静音,则可以听到声音 我如何设置声音,没有声音,如果音量静音,我也想降低音量,因此按钮的声音也会降低
谢谢