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

后端 未结 8 753
梦如初夏
梦如初夏 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 22:58

    I got this problem and a colleague helped me out. If you got this error message: "entityForName: nil is not a legal NSManagedObjectContext parameter searching for entity name". And you made changes in you coredata model. I think the problem might not be the code.

    The solution can be simple. Try one of those options:

    • Just delete the app from the device you are testing, it should have the old version of your model.
    • Create another database version using Xcode, >Editor>Add Model Version.

    Hope it helps.

提交回复
热议问题