I'm using NSFetchedResultsController for my table view. I call -performFetch inside my controller's -viewDidLoad method.
Sometimes my controller gets unloaded and then re-loaded, resulting in another call to -viewDidLoad and -performFetch. I found that this was causing an error: "NSFetchedResultsController error: section '(null)' not found in controller". I found that calling -performFetch multiple times like this was causing the problem, and modified my -viewDidLoad: method to do the following:
if( fetchedResCtrlr.fetchedObjects == nil )
{
NSError *error;
if ( ![fetchedResCtrlr performFetch:&error] )
...
}
Being new to Core Data, I'm wondering if this is the correct action to take. Should I actually be able to call -performFetch: more than once without error? Should I be doing something in -viewDidUnload:?
Thanks!