title: Core Data - Datasource methods is called before viewDidLoad
body: <p>I have noticed that a problem in my app is caused because the Datasource methods of the <code>UITableView</code> are called before <code>viewDidLoad</code>.</p>
  
  <p>The problem is that the <code>UITableView</code> doesn't have the correct amount of rows, it gets the amount of rows from the <code>NSFetchedResultsController</code> but the <code>performFetch</code> "function" for that is called in the <code>viewDidLoad</code> method which for some reason is called after the Datasource methods.</p>
  
  <p>Here's the source of the two important methods:</p>
  
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
  
   self.tableView.allowsSelectionDuringEditing = NO;
   self.tableView.editing = YES;
   self.title = [NSString stringWithFormat:@"%@", [[game valueForKey:@"title"] description]];
  
      NSError *error = nil;
      if (![[self fetchedResultsController] performFetch:&amp;error]) {
          NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
          abort();
      }
  
  }
  
  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
      id &lt;NSFetchedResultsSectionInfo&gt; sectionInfo = [[fetchedResultsController sections] objectAtIndex:section];
      return [sectionInfo numberOfObjects];
  }
  </code></pre>
  
  <p>How do I get past this problem? </p>