CoreData error: +entityForName: could not locate an NSManagedObjectModel for entity name

后端 未结 6 633
失恋的感觉
失恋的感觉 2021-01-02 09:06

I\'ve been struggling with CoreData for a few days, but I keep getting this error:

\'NSInternalInconsistencyException\', reason: \'+enti

6条回答
  •  遥遥无期
    2021-01-02 09:29

    I had a similar problem and found TechZen's answer to be helpful (especially the suggestion to check the entities). However, my problem turned out to be a variant of (2): I could see that the moc itself wasn't nil, but I hadn't set the persistent store coordinator.

    [aManagedObjectContext setPersistentStoreCoordinator:persistentStoreCoordinator]
    

    or similar.

    I'd add this as a comment to TechZen's answer, but can't yet, and want to include it in case someone else has my problem.

提交回复
热议问题