EXC_BAD_INSTRUCTION 尝试在 Swift 操场 (Xcode 12.4) 中加载文件时

时间:2021-03-14 01:41:08

标签: swift xcode swift-playground

我有这个代码来加载一个简单的 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.")
}

错误消息有点神秘,我不知道如何调试。感谢您的帮助,谢谢!

0 个答案:

没有答案