我正在尝试使用 CoreData,但每当我尝试存储对象时,我都会收到 EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) 错误。什么可能导致此错误?作为旁注,我最初并没有创建打算使用 CoreData 的项目,所以 CoreData 是我后来添加到我的项目中的(我不知道这是否是导致问题的原因)。
lazy var managedObjectModel: NSManagedObjectModel = {
// The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model.
let modelURL = NSBundle.mainBundle().URLForResource("repliaoutput", withExtension: "momd")!
return NSManagedObjectModel(contentsOfURL: modelURL)! //this line is where the EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) error is
}()