2012-02-27 40 views
0

有没有办法获得特定的数据列/属性,例如(日期)从我的对象,同时使用挂起更改选项?NSFetchRequest includesPendingChanges和propertiesToFetch

我希望能够搜索尚未保存的待处理更改,但我也只想要特定的列。我不需要整个对象。我基本上想要获得不同的日期并将它们返回到数组中。

另一种选择是只获取整个对象,但如果可能的话,可以使用includesPendingChanges和Distinct。

回答

0

我最后使用基于代码hereNSFetchController。我基于我的抓取控制器。

NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:[[DataManager sharedInstance] managedObjectContext] sectionNameKeyPath:@"date" cacheName:@"List"]; 

这个分组基于日期所以我所有的对象时,我所需要的独特的日期,我只需要调用[fetchedResultsControllers sections]