I have a question regarding how to pass around NSManagedObjectContext. In my app, it seems like it’s my AppDelegate that handles NSManagedObjectContext, so I shouldn’t create other NSManagedObjectContexts in my other ViewControllers.
So the question is…
There is any convention or smart method to do this?
Thanks.
The way I pass the NSManagedObjectContext is to simply have an iVar in each view controller you pass it to. I usually modify the initialiser to include assignment, something like this….
MyNewViewController.h
MyNewViewController.m
Then when you call the view controller, you simply use the modified initialiser. Like…
Now you’ve got a reference to the managedObjectContext which you can use within your view controller.