我有这个代码来加载一个简单的 JSON 文件。我正在 Swift 的操场上练习。但是当我运行代码时,我得到
error: Execution was interrupted, reason: EXC_BAD_INSTRUCTION`
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
struct Quote {
var author: String
var quote: String
}
import Foundation
guard let fileUrl = Bundle.main.url(forResource: "quotesExample", withExtension: "json")
else {
fatalError("Error.")
}
错误消息有点神秘,我不知道如何调试。感谢您的帮助,谢谢!