我不能得到这个代码工作,我不断收到一个错误说:
参数标签“(FileURLWithPath :)”不匹配任何可用过载
do {
audioPlayer = try
AVAudioPlayer(contentsOf:
URL(FileURLWithPath: sound!))
audioPlayer.prepareToPlay()
} catch {
print("error")
}
你有什么建议吗?
其中提到的错误Argument labels '(FileURLWithPath:)' do not match any available overloads
是相当显着。
更换
AVAudioPlayer(contentsOf: URL(FileURLWithPath: sound!))
同
AVAudioPlayer(contentsOf: URL(fileURLWithPath: sound!))