需要确保NSFetchedResultsController被调用

时间:2011-07-29 23:23:20

标签: iphone objective-c xcode nsfetchedresultscontroller

我有一个NSFetchResultsController,但我需要确保在调用viewDidLoad中的一行之前调用它。

该行是self.todaySession = (Session *)[fetchedResultsController objectAtIndexPath:0];

有没有办法确保在调用此行之前调用fetch?

1 个答案:

答案 0 :(得分:1)

如果通过在该行上方插入一个调用获取结果控制器的行来进行操作呢?

您将从该行代码中崩溃。整数文字0不是NSIndexPath实例。你可能想要这样的东西:

self.todaySession = (id)[frc objectAtIndexPath:[NSIndexPath indexPathWitRow:0 
                                                                    section:0]];
相关问题