I have an NSMutableArray with a few NSManagedObjects in it which I fetched from my managedObjectContext. How can I edit the managedObjects and write replace the old object with the new one?
I'm taking the object like this from the array:
NSManagedObject *managedObject = [_dataArray objectAtIndex:indexToTest];
[managedObject setValue:@"sucessfully updated!" forKey:@"hint"];
My problem is, how can I update the managedObject in the managedObjectContext?
Thanks for helping
NSManagedObject *object = [[self fetchedResultsController] objectAtIndexPath:indexPath];
[object setValue: self.urlField.text forKey:@"url"];
NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
NSError *error = nil;
if (![context save:&error]) {}