我一直在尝试使用Xcode中的Swift在iOS模拟器上播放音频,但是我得到的只是以下错误。是什么引起了这个问题?
2018-11-08 21:30:14.752040-0800 [9055:150546] Error loading /Library/Audio/Plug-Ins/HAL/NRDAudioClnt.plugin/Contents/MacOS/NRDAudioClnt: dlopen(/Library/Audio/Plug-Ins/HAL/NRDAudioClnt.plugin/Contents/MacOS/NRDAudioClnt, 262): no suitable image found. Did find: /Library/Audio/Plug-Ins/HAL/NRDAudioClnt.plugin/Contents/MacOS/NRDAudioClnt: mach-o, but not built for iOS simulator 2018-11-08 21:30:14.752328-0800 [9055:150546] Cannot find function pointer NRDACLN_New_Instance for factory <CFUUID 0x600002b8d660> 3E9FAD07-70A8-4980-B39B-BB8B905C9872 in CFBundle/CFPlugIn 0x7fe6d950d740 </Library/Audio/Plug-Ins/HAL/NRDAudioClnt.plugin> (bundle, not loaded)
这是我在运行下面的代码时遇到的错误。
let url = Bundle.main.url(forResource: "beat3", withExtension: "wav")
do {
try openingAudioPlayer = AVAudioPlayer(contentsOf: url!)
openingAudioPlayer.numberOfLoops = -1
openingAudioPlayer.play()
} catch let error {
}