Core data NSFetchResults更新委托第一次工作,第二次崩溃

Core data NSFetchResults更新委托第一次工作,第二次崩溃,core-data,nsfetchedresultscontroller,Core Data,Nsfetchedresultscontroller,我环顾四周寻找类似的答案,但我的问题似乎有点不同 我有一个绑定到NSFetchResultsController的UITableView。目标是提取一些数据,在上下文中添加几行,然后自动更新表。很简单,对吧? init->empty table->performFetch->create some objects in Context->delegate查看并更新我的表 我使用样本NSFetchResultsController来注意当前上下文何时被修改 当我在干净的模拟器/iOS平台上运行时,

我环顾四周寻找类似的答案,但我的问题似乎有点不同

我有一个绑定到NSFetchResultsController的UITableView。目标是提取一些数据,在上下文中添加几行,然后自动更新表。很简单,对吧? init->empty table->performFetch->create some objects in Context->delegate查看并更新我的表

我使用样本NSFetchResultsController来注意当前上下文何时被修改

当我在干净的模拟器/iOS平台上运行时,NSFetchController成功地识别出上下文中的数据已经更新。但如果我再次运行该应用程序,则会出现以下错误:

CoreData: error: Serious application error.  Exception was caught during Core Data change
processing.  This is usually a bug within an observer of 
NSManagedObjectContextObjectsDidChangeNotification.  *** -[__NSArrayI objectAtIndex:]: 
index 40 beyond bounds for empty array with userInfo (null)
调用[self.tableView beginUpdates]时发生崩溃


在我的调试中,我可以看到“[fetchedResultsController FetchedObject]”是完全空的,我认为这就是问题所在-自从我修改了上下文后,这不应该用我的测试数据更新吗?我使用Apple Recipe和CoreDataBooks示例作为参考。

我认为这是因为类中的数据模型不适合.xcdatamodeld文件中的实体