Update! I've created a sanitized test program that illustrates the issue.
Here you can view a PDF of exactly what I've done, and download a .zip of the projectUpdate2! See the comment thread of Conceited Code below to understand more about this problem.
Update: Added bounty, I'm looking for an explanation of what's actually wrong with my example, what fixes it, and what design better suits my purpose than the current "LoadNib_Controller" (see Conceited Code comment discussion)
I get a runtime error message
" [<
My_WindowLoader 0x100228ba0>
valueForUndefinedKey:]: this class is not key value coding-compliant for the key managedObjectContext. "
My_WindowLoader has a reference to My_AppDelegate (which I've debugged and is definitely set up properly). It also has a few My_WindowController *'s.. which are My_WindowController : NSWindowController. They are used so that I can provide a property (managedObjectContext) to Windows that load up as I load nib's up, so that I can set up my Core Data bindings. They look like..
.h:
@interface My_WindowController : NSWindowController {
NSManagedObjectContext *managedObjectContext;
}
@property (nonatomic, retain) NSManagedObjectContext *managedObjectContext;
.m
@synthesize managedObjectContext;
My_WindowLoader loads a nib in the following manner:
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's 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];
To get the above runtime error, within my Window1.nib I have array controllers that bind their Managed Object Context to "File Owner" with model key path "managedObjectContext". File's Owner is type My_WindowController
Obviously something is wrong but I've stepped through it with a debugger as well as using common sense, and it all seems like it should work. I see most "this class is not kvc.." errors stem from misnaming stuff in IBOutlet/IB etc but I have triple checked all of that here and I have ensured that I completely quit and restarted Xcode/IB and have the latest loaded.