Re: Managed Object Context Reference

2010-06-01 Thread Richard Somers
On May 31, 2010, at 11:53 PM, Quincey Morris wrote: You've created another scenario by making your view need the managed object context (probably during 'drawRect:' at least?). If the view has to redraw when your application is in the background, you'll hit your assert. I think something

Re: Managed Object Context Reference

2010-06-01 Thread Richard Somers
On Jun 1, 2010, at 2:37 AM, Joanna Carter wrote: Richard, this really points to an "abuse" of the MVC design pattern :-) ... This ensures separation between the View and the Model it is meant to be representing. Using a delegate to obtain the data required for drawing a View means that th

Re: Managed Object Context Reference

2010-06-01 Thread Joanna Carter
Le 1 juin 2010 à 06:53, Quincey Morris a écrit : > You've created another scenario by making your view need the managed object > context (probably during 'drawRect:' at least?).… Richard, this really points to an "abuse" of the MVC design pattern :-) If you look at some of the Cocoa controls, l

Re: Managed Object Context Reference

2010-05-31 Thread Quincey Morris
On May 31, 2010, at 22:26, Richard Somers wrote: > Currently I have been getting a reference to the managed object context on > the fly as needed using the document controller. This has worked fine, except > today I got a "Document is nil." assertion failure. I have not been able to > repeat th

Re: Managed Object Context Reference

2010-05-31 Thread Richard Somers
On May 31, 2010, at 3:40 PM, Joanna Carter wrote: Normally, I find it easier to write read-only, lazy instantiating, properties for the Persistent Store Coordinator, MOM and MOC, in the Controller., Then it is easy to bind any objects in the NIB, that require the MOC. Yes, I agree. My Fil

Re: Managed Object Context Reference

2010-05-31 Thread Richard Somers
On May 31, 2010, at 3:54 PM, Quincey Morris wrote: You can set it yourself. If you give the view an outlet to File's Owner, you can do it in the view's awakeFromNib: self.managedObjectContext = self.windowControllerOutlet.document.managedObjectContext; // or self.managedObjectContext =

Re: Managed Object Context Reference

2010-05-31 Thread Quincey Morris
On May 31, 2010, at 14:54, Quincey Morris wrote: > self.managedObjectContext = > self.windowControllerOutlet.document.managedObjectContext; BTW, if it can happen that the window is loaded before the window controller is added to the the document's window controller list, windowController

Re: Managed Object Context Reference

2010-05-31 Thread Quincey Morris
On May 31, 2010, at 14:03, Richard Somers wrote: > Apple's documentation seems to indicate that if you have an object in a nib > with a managed object context outlet, that you can somehow set the outlet. > > The Core Data Programming Guide states "If you are setting the reference to > the conte

Re: Managed Object Context Reference

2010-05-31 Thread Joanna Carter
Hi Richard > Apple's documentation seems to indicate that if you have an object in a nib > with a managed object context outlet, that you can somehow set the outlet. > > The Core Data Programming Guide states "If you are setting the reference to > the context in a nib file, make sure the approp

Managed Object Context Reference

2010-05-31 Thread Richard Somers
Apple's documentation seems to indicate that if you have an object in a nib with a managed object context outlet, that you can somehow set the outlet. The Core Data Programming Guide states "If you are setting the reference to the context in a nib file, make sure the appropriate outlet or