CoreDataを使用しようとしていますが、オブジェクトを保存しようとすると、EXC_BAD_INSTRUCTION(コード= EXC_I386_INVOP、サブコード= 0x0)というエラーが表示されています。このエラーの原因は何ですか?補足として、私は最初にCoreDataを使う予定のプロジェクトを作成しなかったので、CoreDataは私のプロジェクトに後で追加したものでした(これが問題の原因かどうかわかりません)。あなたは後の段階でコアデータを作成している場合は、modelURL にパスを取得している場合Swift CoreData EXC_BAD_INSTRUCTION(コード= EXC_I386_INVOP、サブコード= 0x0)
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
}()