0
當我試圖按按鈕時添加音頻,但我發現了以下錯誤斯威夫特3:使用AVAudioPlayer
「不匹配任何重載音頻」錯誤「的說法標籤contentsOfURL,錯誤不匹配任何重載音頻」
var ButtonAudioURL = NSURL(fileURLWithPath: Bundle.main.path(forResource: "Slag", ofType: "m4a")!)
var clickAudioPlayer = AVAudioPlayer()
class UIViewController: UIViewController {
clickAudioPlayer = AVAudioPlayer(contensOfURL: ButtonAudioURL, error: nil) //This is in this line i get the error
}
@IBAction func ASButton(_ sender: UIButton) {
}
錯誤發生在
clickAudioPlayer = AVAudioPlayer(contensOfURL: ButtonAudioURL, error: nil)
這裏呢?這仍然開放?我有一個運行音頻的代碼 –