Update! I created a sanitized test program that illustrates the problem.
Here you can view the PDF file of exactly what I did and download the project .zip
Update2! See explanations for the comments below to learn more about this issue.
Update: a bounty has been added, I'm looking for an explanation of what is actually wrong with my example, what fixes it, and which design is better for my purpose than the current "LoadNib_Controller" (see the discussion of comments with comments)
I get a runtime error "[ <My_WindowLoader 0x100228ba0 >valueForUndefinedKey:]: this class is not the key for encoding the key for the managedObjectContext key."
My_WindowLoader has a link to My_AppDelegate (which I debugged and definitely configured correctly). It also has several My_WindowController *, which are My_WindowController: NSWindowController. They are used so that I can provide the (managedObjectContext) property for Windows, loaded when nib boots, so I can configure Core Data bindings. They look like ..
.h:
@interface My_WindowController : NSWindowController {
NSManagedObjectContext *managedObjectContext;
}
@property (nonatomic, retain) NSManagedObjectContext *managedObjectContext;
.m
@synthesize managedObjectContext;
My_WindowLoader loads the tip as follows:
Window1_WindowController = [[My_ WindowController alloc] initWithWindowNibName:@"Window1" owner:self];
// The following line I have debugged and it does in fact go to my app delegate, wherein it instantiates a MOC (since this is the first place in the code that it used..), and returns it, and it appears to also be setting it via the property in My_WindowController
[Window1_WindowController setManagedObjectContext:[AppDelegate managedObjectContext]];
// The following is where I get my problem, this does load my window but in my gdb window I see the runtime error message that I list at the top of this post
NSWindow *window1Pointer = [Window1_WindowController window];
, Window1.nib , " " "managedObjectContext". - My_WindowController
, - , , , , . , " kvc.." IBOutlet/IB .., , , Xcode/IB .