核心数据启动错误Domain = NSCocoaErrorDomain代码= 134140“(null)”

时间:2018-07-29 19:50:20

标签: ios swift core-data

代码构建,但是在加载Core数据时启动时出现致命错误

lazy var persistentContainer: NSPersistentContainer = {
    /*
     The persistent container for the application. This implementation
     creates and returns a container, having loaded the store for the
     application to it. This property is optional since there are legitimate
     error conditions that could cause the creation of the store to fail.
    */
    let container = NSPersistentContainer(name: "GridModel")
    container.loadPersistentStores(completionHandler: { (storeDescription, error) in
        if let error = error as NSError? {

            fatalError("Unresolved error \(error), \(error.userInfo)")
        }
    })
    return container
  }()

输出窗口中的错误消息是:

myApp[8117:177239] [error] error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///Users/xyz/Library/Developer/CoreSimulator/Devices/B58967C7-E8BA-4ED9-826A-1AB52B6C1EAC/data/Containers/Data/Application/94CFF817-B0C6-4BF4-8979-382E7C74485F/Library/Application%20Support/GridModel.sqlite options:{
    NSInferMappingModelAutomaticallyOption = 1;
    NSMigratePersistentStoresAutomaticallyOption = 1;
} ... returned error Error Domain=NSCocoaErrorDomain Code=134140 "(null)" UserInfo={sourceModel=(<NSManagedObjectModel: 0x60000028e740>) isEditable 1, entities {..... lists all the entities with long list of errors here.. }

我认为我不小心点击了Xcode菜单->编辑器->添加模型版本。

看起来像模型中的一些错误。 我不确定这是否导致了错误,并且我不知道如何以及为什么?'

有人可以建议吗?

0 个答案:

没有答案