Core Data NSManagedObject doesn't have a valid NSEntityDescription

坚强是说给别人听的谎言 提交于 2019-12-04 20:51:43

Try changing:

let container = NSPersistentContainer(name: "DELETE")

to this:

let container = NSPersistentContainer(name: "StudyHub")

According to documentation:

By default, the provided name value is used to name the persistent store and is used to look up the name of the NSManagedObjectModel object to be used with the NSPersistentContainer object.

I had a similar problem. I went into App Delegate and found that let container = NSPersistentContainer(name: "Your App Name") didn't match the name of my data model.

I changed it to the name of my data model and it now works.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!