为什么在Swift上播放声音时出现此错误?

时间:2019-05-27 01:27:47

标签: swift

我正在做游戏,当角色触摸某个项目会发出声音,但是当这种情况发生时,就会出错。

文件和文件夹存在,因此解包没有问题。

let fileLocation = Bundle.main.path(forResource: "cash", ofType: ".mp3", inDirectory: "Sounds")
do {
    try player = AVAudioPlayer(contentsOf: URL(fileURLWithPath: fileLocation!))
    player.play()
} catch {
    print("error")
}

然后我得到以下错误:

  

2019-05-26 18:55:43.401967-0600 [9064:1559541] [AudioHAL_Client]   HALC_ProxyIOContext.cpp:1032:IOWorkLoop:   HALC_ProxyIOContext :: IOWorkLoop:无法发送或接收消息   从服务器上,错误:0x10000003

     

2019-05-26 18:55:43.509229-0600 [9064:1559868] [AudioHAL_Client]   HALB_IOThread.cpp:251:_Start:HALB_IOThread :: _ St​​art:已经有   线程

     

2019-05-26 18:55:43.597266-0600 [9064:1560027] [aqme] 1396:   AQDefaultDevice:放弃I / O周期,因为重新配置未决(1)。

有人知道如何解决吗?

0 个答案:

没有答案
相关问题