I have an NSViewController with its own nib that requires access to the managedObjectContext to display objects in a tableview. This is how I have the managed object context set up in my view controller:
@interface {
...
NSManagedObjectContext* managedObjectContext;
...
}
@property (nonatomic, retain) NSManagedObjectContext* managedObjectContext;
@implementation {
...
@synthesize managedObjectContext;
...
}
in awakeFromNib
I initialize it as follows:
managedObjectContext = [[NSApp delegate] managedObjectContext];
I have the tableview hooked up to an NSArrayController
in interface builder (exactly as in this tutorial) and I have its managedObjectContext
set to my view controller's managedObjectContext
.
What could be the source of this error?