title: NSFetchedResultsController crashing on performFetch: when using a cache
body: <p>I make use of NSFetchedResultsController to display a bunch of objects, which are sectioned using dates. On a fresh install, it all works perfectly and the objects are displayed in the table view. However, it seems that when the app is relaunched I get a crash. I specify a cache when initialising the NSFetchedResultsController, and when I don't it works perfectly.</p>
  
  <p>Here is how I create my NSFetchedResultsController:</p>
  
  <pre><code>- (NSFetchedResultsController *)results {
      // If we are not nil, stop here
      if (results != nil)
          return results;
  
      // Create the fetch request, entity and sort descriptors
      NSFetchRequest *fetch = [[NSFetchRequest alloc] init];
      NSEntityDescription *entity = [NSEntityDescription entityForName:@"Event" inManagedObjectContext:self.managedObjectContext];
      NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"utc_start" ascending:YES];
      NSArray *descriptors = [[NSArray alloc] initWithObjects:descriptor, nil];
  
      // Set properties on the fetch
      [fetch setEntity:entity];
      [fetch setSortDescriptors:descriptors];
  
      // Create a fresh fetched results controller
      NSFetchedResultsController *fetched = [[NSFetchedResultsController alloc] initWithFetchRequest:fetch managedObjectContext:self.managedObjectContext sectionNameKeyPath:@"day" cacheName:@"Events"];
      fetched.delegate = self;
      self.results = fetched;
  
      // Release objects and return our controller
      [fetched release];
      [fetch release];
      [descriptor release];
      [descriptors release];
      return results;
  }
  </code></pre>
  
  <p>These are the messages I get when the app crashes:</p>
  
  <pre><code>FATAL ERROR: The persistent cache of section information does not match the current configuration.  You have illegally mutated the NSFetchedResultsController's fetch request, its predicate, or its sort descriptor without either disabling caching or using +deleteCacheWithName:
  *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FATAL ERROR: The persistent cache of section information does not match the current configuration.  You have illegally mutated the NSFetchedResultsController's fetch request, its predicate, or its sort descriptor without either disabling caching or using +deleteCacheWithName:'
  </code></pre>
  
  <p>I really have no clue as to why it's saying that, as I don't believe I'm doing anything special that would cause this. The only potential issue is the section header (day), which I construct like this when creating a new object:</p>
  
  <pre><code>// Set the new format
  [formatter setDateFormat:@"dd MMMM"];
  
  // Set the day of the event
  [event setValue:[formatter stringFromDate:[event valueForKey:@"utc_start"]] forKey:@"day"];
  </code></pre>
  
  <p>Like I mentioned, all of this works fine if there is no cache involved. Any help appreciated!</p>