Need To Make Sure NSFetchResultsController Is Called
I have a NSFetchResultsController but I need to make sure 开发者_如何转开发it is called before a line in my viewDidLoad
is called.
The line is self.todaySession = (Session *)[fetchedResultsController objectAtIndexPath:0];
Is there a way I can make sure the fetch is called before this line is called?
How about by inserting a line that calls your fetch results controller just above that line?
You will get a crash from that line of code. The integer literal 0
is not an NSIndexPath
instance. You probably want something like this:
self.todaySession = (id)[frc objectAtIndexPath:[NSIndexPath indexPathWitRow:0
section:0]];
精彩评论