'+entityForName: nil is not a legal NSManagedObjectContext parameter - Core Data

后端 未结 8 749
梦如初夏
梦如初夏 2020-11-28 22:26

I have added all of the relevant code to the App Delegate, and I am able to add to the data model and fetch from the data model in applicationDidFinishLaunchingWithOptions.<

8条回答
  •  半阙折子戏
    2020-11-28 23:03

    In my case the .xcdatamodeld was mislabeled in the AppDelegate:

     let container = NSPersistentContainer(name: "name of data model")
    

提交回复
热议问题