Re: NSWindowController for Prefs XIB Question (Core Data involved) - Solved
Re: NSWindowController for Prefs XIB Question (Core Data involved) - Solved
- Subject: Re: NSWindowController for Prefs XIB Question (Core Data involved) - Solved
- From: Steve Cronin <email@hidden>
- Date: Sat, 22 May 2010 01:30:47 -0500
Folks;
I have figured at least part of this out.
My PrefsController had an instance variable that was of a class from the Core Data Model.
Since the MOC was not available until after the initWithWindow, anything derived from NSManagedObject is not valid.
Once I removed this instance variable the window now now opens.
Hopefully this is helpful to someone else….
Steve
>> On May 20, 2010, at 10:08 PM, Steve Cronin wrote:
>>
>>> 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
>
_______________________________________________
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