title: Dynamically setting fetchLimit for NSFetchedResultsController
body: <p>I'm using am NSFetchedResultsController to populate data onto a UITableView.
  It's a simple chat app and I want to load the latest 25 messages onto the table first and load more as the user scrolls up to see older messages (the chat message are in a ascending order).</p>
  
  <p>I call a method that will setFetchLimit: for the NSFetchedResultsController in the willDisplayCell: like so....</p>
  
  <pre><code>- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
  {
      if(indexPath.row == 0)
      {
          [self performSelector:@selector(getMoreMessages) withObject:nil afterDelay:1.0];
      }
  }
  </code></pre>
  
  <p>when the first row of the UITableView has been displayed, getMoreMessages will try to reset the fetchLimit reload the UITableView like so.....</p>
  
  <pre><code>- (void)getMoreMessages
  {
      maxListItems += 25;
      NSLog(@"set maxListItems: %d", maxListItems);
      [self.resultsController.fetchRequest setFetchLimit:maxListItems];
      [self._tableView reloadData];
  }
  </code></pre>
  
  <p>However, it doesn't seem to be working, the table data will not change.
  The initial NSFetchRequest is set like so...</p>
  
  <pre><code>NSFetchRequest *chatDataRequest = [[NSFetchRequest alloc] init];
  NSEntityDescription *entity = [NSEntityDescription entityForName:@"ChatData" inManagedObjectContext:appDelegate.managedObjectContext];
  [chatDataRequest setEntity:entity];
  
  NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(key != 0 OR messageNo != 0) and matchNo = %d", matchNo];
  [chatDataRequest setPredicate:predicate];
  
  NSSortDescriptor *sortDescripter1 = [[NSSortDescriptor alloc] initWithKey:@"status" ascending:YES];
  NSSortDescriptor *sortDescripter2 = [[NSSortDescriptor alloc] initWithKey:@"messageNo" ascending:YES];
  NSArray *sortDescripters = [[NSArray alloc] initWithObjects:sortDescripter1, sortDescripter2, nil];
  [chatDataRequest setSortDescriptors:sortDescripters];
  [sortDescripters release];
  [sortDescripter1 release];
  [sortDescripter2 release];
  
  [chatDataRequest setFetchLimit:25];
  
  NSFetchedResultsController *fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:chatDataRequest managedObjectContext:appDelegate.managedObjectContext sectionNameKeyPath:nil cacheName:[NSString stringWithFormat:@"%d_chat.cache", matchNumber]];
  [chatDataRequest release];
  fetchedResultsController.delegate = self;
  NSError *error;
  BOOL success = [fetchedResultsController performFetch:&amp;error];
  if(!success) NSLog(@"error: %@", error);
  self.resultsController = fetchedResultsController;
  </code></pre>
  
  <p>And back to the question.</p>
  
  <p><strong>How can one dynamically change the fetchLimit for an NSFetchedResultsController?</strong></p>
  
  <p>Any hits would be awesome!
  Thanks!</p>