更新时间:2023-01-05 08:50:29
请确保您的设备未触发进入静音模式.
另外,对于简短的系统声音,您可以使用AudioToolbox的系统声音( https://developer.apple.com/library/ios/documentation/AudioToolbox/Reference/SystemSoundServicesReference/):
Make sure that your device is not triggered into silent mode.
Also, for short system sounds you can use System Sounds from AudioToolbox (https://developer.apple.com/library/ios/documentation/AudioToolbox/Reference/SystemSoundServicesReference/):
if let soundURL = NSBundle.mainBundle().URLForResource("Metal_Gong", withExtension: "wav") {
var mySound: SystemSoundID = 0
AudioServicesCreateSystemSoundID(soundURL, &mySound)
AudioServicesPlaySystemSound(mySound);
}