Swift 函数体导致“中止:陷阱6错误代码”`

Swift 函数体导致“中止:陷阱6错误代码”`,swift,Swift,我只知道,当我取消注释这个函数体时: static func removeFilter(by id: UUID, from ticket: Ticket, using context: NSManagedObjectContext) { let first = ticket.filterArray.first { filter in filter.uniqueID == id } guard let first = first else { return

我只知道,当我取消注释这个函数体时:

static func removeFilter(by id: UUID, from ticket: Ticket, using context: NSManagedObjectContext) {
    let first = ticket.filterArray.first { filter in
        filter.uniqueID == id
    }

    guard let first = first else { return }
    context.delete(first)
    try? context.save()
}
我得到了那个错误。。而且代码不会编译。。我希望我能提供更多的上下文,但这是一个非常模糊的错误消息

filterArray
[CustomType]

CustomType {
    let size: String
    let uniqueID: UUID
}
CustomType
是CoreData的managedObjectContext


(如果认为相关,将添加更多代码)

“CustomType是managedObjectContext”?真正地真的吗?不管怎样,编译器崩溃是苹果的错误,你应该向他们报告。我们对此无能为力。