title: How to update NSManagedObject?
body: <p>I have this code:</p>
  
  <pre><code>-(void)didEditCard:(NSMutableArray*)theArray {
      // Create a new instance of the entity managed by the fetched results controller.
      NSManagedObject *newManagedObject = [[self fetchedResultsController] objectAtIndexPath:theSIndePath];
  
      // If appropriate, configure the new managed object.
      [newManagedObject setValue:[theArray objectAtIndex:0] forKey:@"frontCard"];
      [newManagedObject setValue:[theArray objectAtIndex:1] forKey:@"flipCard"];
  
  }
  </code></pre>
  
  <p>I knew which managed object was touched in the table view. If the player touches on a cell a view comes up and he can edit the entries. If he clicks on done then the above method will be called. BTW nothing is nil. But if i call setValue i won't be updated in core data.</p>
  
  <p>My goal is: I want to update a managed object which should update the core data file to or i want to remove the object from the core data file and then add the new one at the exact same place.</p>
  
  <p>Can someone help me please?</p>
  
  <p>edit: </p>
  
  <p>i tried this: but it doesn't work: (it doesn't gets updated)</p>
  
  <pre><code>-(void)didEditCard:(NSMutableArray*)theArray {
      // Create a new instance of the entity managed by the fetched results controller.
      NSManagedObject *managedObject = [[self fetchedResultsController] objectAtIndexPath:theSIndePath];
  
      // If appropriate, configure the new managed object.
      [managedObject setValue:[theArray objectAtIndex:0] forKey:@"frontCard"];
  
      NSManagedObjectContext *context = [[self fetchedResultsController] managedObjectContext];
      // Save the context.
      NSError *error = nil;
      if (![context save:&amp;error]) {
          /*
           Replace this implementation with code to handle the error appropriately.
  
           abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. If it is not possible to recover from the error, display an alert panel that instructs the user to quit the application by pressing the Home button.
           */
          NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
          abort();
      }
  
  
  }
  </code></pre>