I have the following structure
Persistent storage ↔ Parent context ↔ MOC (on the main topic) ↔ MOC background thread (MOC = Managed object context)
So I'm doing some work in the background context
// Create a background context. NSManagedObjectContext* context = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType]; context.parentContext = self.document.managedObjectContext; // Start using it, but in its own thread! [context performBlock:^ {...
I am extracting some objects from the table and deleting some of them in context.
NSFetchRequest* request = [NSFetchRequest fetchRequestWithEntityName:@"User"]; NSArray* userQueryResults = [context executeFetchRequest:request error:&error]; for (int i = 0; i < userQueryResults.count; i++) { if(someCondition) [context deleteObject:[userQueryResults objectAtIndex:bla]; }
Now, let's say I want to restore only the remaining users to an array ...
Will it return all users that were originally there, or only restore those that were not deleted?
If I were to keep my "context" doesn't matter?
Basically I am trying to understand the difference between selections and save with nested contexts ...
thanks
source share