For example, if I have an NSManagedObject named Items , and I want to set ManagedObjectContext later (and not during initialization), how would I do it?
I am currently doing this:
Items *item = [NSEntityDescription insertNewObjectForEntityForName:@"Items" inManagedObjectContext:_context];
This automatically associates it with _context .
But what if I want to do this:
Items *item = [[Items alloc] init]; item.first = @"bla"; item.second = @"bla bla";
And I would like to pass this object to another method, which will then associate it with the context and store it.
So, is there a way to make a simple item.managedObjectContext = _context or something like that?
source share