• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSWindowController for Prefs XIB Question (Core Data involved) - Solved
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >NSWindowController for Prefs XIB Question (Core Data involved) (From: Steve Cronin <email@hidden>)
 >Re: NSWindowController for Prefs XIB Question (Core Data involved) (From: Steve Cronin <email@hidden>)

  • Prev by Date: Re: Core data model persistence, independent of document
  • Next by Date: Re: Forcing NSImage to cache images at certain sizes
  • Previous by thread: Re: NSWindowController for Prefs XIB Question (Core Data involved)
  • Next by thread: View manipulation problem
  • Index(es):
    • Date
    • Thread