相关疑难解决方法(0)

CoreData错误让我发疯... CoreData:严重的应用程序错误.从NSFetchedResultsController的委托中捕获的异常

我的应用程序有两个标签栏...每个用户都带一个tableviewcontroller,向他提供一个项目列表.第一个视图允许用户记录数据库中的条目.另一个选项卡/视图从数据库读取并将这些项呈现给用户,但是,没有从第二个视图对coreData/persistant存储进行更新.

当我通过第一个viewcontroller添加一个新项目时,它在视图中完美显示.但是,只要我点击另一个标签栏以查看新项目出现在该viewcontroller中,我就会收到下面列出的错误,并且新添加的项目不会出现...注意:如果我停止应用并重新加载/重新运行它,并通过点击第二个标签栏开始,新项目显示正常,所以我知道模型正在更新.

*** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-1912.3/UITableView.m:1046
2011-10-20 20:56:15.117 Gtrac[72773:fb03] CoreData: error: Serious application error.  An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:.  Invalid update: invalid number of rows in section 0.  The number of rows contained in an existing section after the update (4) must be equal to the number of rows contained in that section before the update (3), plus or minus the number of rows inserted or deleted from …
Run Code Online (Sandbox Code Playgroud)

iphone core-data uitableview nsfetchedresultscontroller nsmanagedobject

12
推荐指数
1
解决办法
8260
查看次数

核心数据:executeFetchRequest vs performFetch

我想要一份关于两者之间比较的详细清单.我所知道的事情:

executeFetchRequest:

  • 消息发送给MOC
  • 返回一个托管对象数组
  • 目标:从持久性存储中获取对象到MOC
  • 使用表视图:与表视图无关
  • 频率:经常在循环中使用,因此可以多次调用

performFetch:

  • 消息已发送至FRC
  • 调用它之后,用于fetchedObjects返回一个托管对象数组
  • 使用表视图:FRC专门用于保持托管对象和表视图行同步,并用于performFetch初始化该进程.
  • 频率:通常只有一次.除非获取的FRC变化的要求,没有必要要求performFetch第二次

如果我错了请纠正我并附上清单.谢谢.

core-data objective-c nsfetchedresultscontroller nsfetchrequest

12
推荐指数
1
解决办法
8195
查看次数