EZAudioFile打开音频文件异常

时间:2019-07-15 11:58:12

标签: swift audiokit

我有以下代码

import AudioKit
import AudioKitUI
import Cocoa

class ViewController: NSViewController {

    override func viewDidLoad() {

        super.viewDidLoad()

        let path = "/Users/user/Desktop/TestFile.mp3"
        let fileManager = FileManager()
        let fileExists = fileManager.fileExists(atPath: path)
        print("fileExists = \(fileExists)")
        let url = NSURL.fileURL(withPath: path)
        print("url = \(url)")
        let file = EZAudioFile(url: url)

    }
}

这将产生以下输出

fileExists = true
url = file:///Users/user/Desktop/TestFile.mp3
2019-07-15 12:52:30.239709+0100 EZAudioPlotExperiment[1660:18497] 231: EXCEPTION (-54): "open audio file"
Error: Failed to create ExtAudioFileRef (-54)

调用EZAudioFile(url: url)时,应用程序崩溃。

这是为什么,怎么解决?

0 个答案:

没有答案