views:

16

answers:

0

I have this code, basically copied from Apple's example:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
 id <NSFetchedResultsSectionInfo> sectionInfo =  [[[[AppDelegate getAppDelegate] myFetchedResultsController] sections] objectAtIndex:section];
    return [sectionInfo numberOfObjects];
}

On 3.1 it works fine. When I try to run on 3.0 it crashes with the following:

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** 
-[NSCFArray objectAtIndex:]: index (0) beyond bounds (0)'

This is so strange. I checked Core Data documentation and there's no changes in API from 3.0 to 3.1 AppDelegate initializes the CoreData and FetchedResultsController just fine. But it crashes only when I try to access objectAtIndex. only in 3.0!