Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 表视图中的双条目_Iphone - Fatal编程技术网

Iphone 表视图中的双条目

Iphone 表视图中的双条目,iphone,Iphone,我似乎遇到了与这里相同的问题: 我有同样的问题,但它是一个UITableViewController。 我使用核心数据和NSFetchedResultsController,使用iPhoneCoreDataRecipes示例代码中的-controllerWillChangeContent、-controller:didChangeSection:atIndex:forChangeType:、-controller:didChangeObject:atIndexPath:forChangeType

我似乎遇到了与这里相同的问题:

我有同样的问题,但它是一个UITableViewController。 我使用核心数据和NSFetchedResultsController,使用iPhoneCoreDataRecipes示例代码中的-controllerWillChangeContent、-controller:didChangeSection:atIndex:forChangeType:、-controller:didChangeObject:atIndexPath:forChangeType:newIndexPath:、和-controllerDidChangeContent

我的问题是,在-viewDidLoad中,我执行了-performFetch,这会正确地重新加载tableView。如果我添加了一个元素,并将图像选择器作为模态视图,则会将其考虑在内,等等。。然后,调用上述方法,并执行第二次插入操作!因此,我最终得到了包含核心数据库中一个对象的双条目的表视图。如果我重新启动应用程序,我只有一个条目,所以这肯定是一个UI更新问题


有什么想法吗?

最后,我使用了第二个托管对象上下文。我通过此上下文保存到持久性存储,并更新主上下文,以便调用NSFetchedResultsControllerDelegate方法。 这正是CoreDataBooks示例实现的