In my AppDelegate.m, in the application: didFinishLaunchingWithOptions:
method, I put the following line:
NSManagedObjectContext *context = [self managedObjectContext];
But it says: AppDelegate may not respond to managedObjectContext. I saw this in a tutorial online, what am I doing wrong? I put #import <CoreData/CoreData.h>
in my App_Prefix.pch file (see Adding Core Data to existing iPhone project) but that didn't help.
The goal is to then set myViewController.context = context
and then use that context to fetch some data in the view controller.
EDIT: Please see my comment to the answer of O. Begemann.