NSWindowController for Prefs XIB Question (Core Data involved)
NSWindowController for Prefs XIB Question (Core Data involved)
- Subject: NSWindowController for Prefs XIB Question (Core Data involved)
- From: Steve Cronin <email@hidden>
- Date: Thu, 20 May 2010 22:08:46 -0500
Folks;
I have a feeling that this is an embarrassing one so try and go easy on me…
XC 3.2.2
I have a main nib that opens a window and that works fine.
I used to have an NSPanel in this nib to handle preferences.
I've decided it's a good idea to split the nib into two different nibs: the main nib and a preferences nib.
I've looked over the Sketch project and used it as a model.
I've also read over the Document-Based App Overview FAQ
I've added a window nib to the project and then subclassed a NSWindowController.
I've made the xib's files owner this window controller
At this point I can get a simple empty window to open just fine.
However, I'm using CoreData and I want to pass the existing MOC to the pref window:
I have added an array controller to the pref nib with its MOC set to files owner's MOC in IB.
The controller manages an entity not a mutable dictionary.
MOC is a synthesized property of the PrefController (the windowController mentioned above).
if (!prefPanelController) {
prefPanelController = [[PreferencesController alloc] initWithWindowNibName:@"testPref"];
[prefPanelController setManagedObjectContext:[self managedObjectContext]];
}
[prefPanelController showWindow:sender];
No window opens and I get a console error: Cannot perform operation without a managed object context
Could someone give me the gentle head slap I need here?
Steve
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden