title: Editing multiple objects in CoreData's fetchedObjects
body: <p>Quite simply I want to iterate through CoreData's <code>[self.fetchedResultsController fetchedObjects]</code> (More specifically I am using MagicalRecord in this example) and change all items that match my criteria (the if statement), then make changes to those objects. </p>
  
  <pre><code>for (Task *aTask in [[self.fetchedResultsController fetchedObjects] mutableCopy]) {
      if ([aTask.day past] &amp;&amp; [[aTask isArchived] isEqual:@(NO)]) {
  
          NSManagedObjectContext *context = [NSManagedObjectContext MR_defaultContext];
          [context MR_saveOnlySelfWithCompletion:^(BOOL success, NSError *error) {
              aTask.day = date;
          }];
      }
  }
  </code></pre>
  
  <p>But as it turns out it doesn't work! I am trying a solution where I don't have to manually manage everything CoreData as this <a href="https://stackoverflow.com/questions/3172379/using-an-nsmutablearray-instead-of-an-nsfetchedresultscontroller">answer</a> specifies and instead find a succinct solution to the problem, few lines of code and not much iteration.  </p>
  
  <p><strong>EDIT:</strong> Following from Dan's answer, I have edited my imperfect code to...</p>
  
  <pre><code>NSPredicate *uncompletedTasks = [NSCompoundPredicate andPredicateWithSubpredicates:@[[NSPredicate predicateWithFormat:@"day &lt; %@ AND isArchived = %@",[NSDate date],@NO]]];
  self.fetchedResultsController = [Task MR_fetchAllSortedBy:@"dateScheduled" ascending:YES withPredicate:uncompletedTasks groupBy:nil delegate:self inContext:[NSManagedObjectContext MR_defaultContext]];
  
  for (Task *aTask in [self.fetchedResultsController fetchedObjects]) {
      aTask.day = date;
  }
  
  NSManagedObjectContext *context = [NSManagedObjectContext MR_defaultContext];
  [context MR_saveOnlySelfWithCompletion:^(BOOL success, NSError *error) {}];
  </code></pre>
  
  <p>This solves the problem, although only momentarily when I update the view, I get this error:</p>
  
  <blockquote>
    <p>CoreData: error: Serious application error.  Exception was caught
    during Core Data change processing.  This is usually a bug within an
    observer of NSManagedObjectContextObjectsDidChangeNotification.  ***
    -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects<a href="https://stackoverflow.com/questions/3172379/using-an-nsmutablearray-instead-of-an-nsfetchedresultscontroller">1</a> with userInfo (null)</p>
  </blockquote>