ios - Editing multiple objects in CoreData's fetchedObjects -


Quite simply I more specifically I'm [self.fetchedResultsController fetchedObjects] to (Using the magic record in this example) and match my criteria (if statement), then make changes in those items, then make changes in those items

  (Task in aTask [[self.fetchedResultsController fetchedObjects] mutableCopy]) {if ([aTask.day past] & amp; & amp; [[aTask isArchived] isEqual: @ (NO)]) {NSManag EdObjectContext * context = [NSManagedObjectContext MR_defaultContext]; [Reference MR_saveOnlySelfWithCompletion: ^ (BOOL success, NSError * error) {aTask.day = date; }]; }}  

But as it turns out that it does not work! I'm trying a solution where I do not need to manually manage everything, because it specifies the durability and instead gets a brief solution to the problem, some lines of code and more walking No.

Edit: After answering the donation, I have edited my incomplete code ...

  NSPredicate * uncompletedTasks = [NSCompoundPredicate andPredicateWithSubpredicates: @ [[NSPredicate predicateWithFormat: @ "day & lt;% @ and reserve =% @", [Ansdit date] @ NO]]]; self.fetchedResultsController = [Task MR_fetchAllSortedBy: @ "dateScheduled" Ascending: Yes withPredicate: uncompletedTasks GroupBy: no representatives: self InContext: [NSManagedObjectContext MR_defaultContext]]; (In Task * Etsc [itself. Reset Controller Faked Object]) {aTask.day = date; } NSManagedObjectContext * context = [NSManagedObjectContext MR_defaultContext]; [Reference MR_saveOnlySelfWithCompletion: ^ (Bell Success, NSError * Error) {}];  

This fixes the problem, however, only when I update the view in transient, I get this error:

CoreData: Error: An exception was caught during the serious application error core data change processing. This is usually a bug within a supervisor of NSManagedObjectContextObjectsDidChangeNotification. *** - [__ NSPlaceholderDictionary initWithObjects: forKeys: count]: Try userInfo (objects with zero) to insert null objects

I do not really know anything about the magical record, but ...

If you want to update them all to improve only the FRC Repeat through all the items obtained by: Br />

1) Update in the background
2) Only the objects are You want to update, fetch it. Example predicate:

  NSPredicate * needUpdate = [NSPredicate predicateWithFormat: @ "Day & lt;% @ and isArchived =% @", [NSDate date] @ NO]; NSPredicate * p = [NSCompoundPredicate and PredicatewithSubpredicates: @ [FRC_predicate, needUpdate]];  

3 After you update all the objects, select one (or in batches, do not save one by one)

Estimating ... < Br /> You have written that an object ( atk. De = date; ) is complete.
It actually keeps the changes you make.
Update before calling "save" process


Comments