Re: Bindings / CoreData / two windows issue
Re: Bindings / CoreData / two windows issue
- Subject: Re: Bindings / CoreData / two windows issue
- From: Timothy Reaves <email@hidden>
- Date: Sun, 4 Dec 2005 14:00:07 -0500
On Dec 4, 2005, at 12:27 PM, Ricky Sharp wrote:
On Dec 4, 2005, at 11:08 AM, Timothy Reaves wrote:
I have a fairly simple app, with two windows. The main window
has a table view that when double-clicked, will open the item in a
separate window to edit. The first time an entry is double-
clicked, a window controller is created and put into a dictionary,
so that subsequent double-clicks will retrieve the existing
controller and open that.
My problem is that the first time the code is run, the window
does not open, and instead I get this error in my log:
2005-12-03 19:31:59.644 Editor[7864] *** -
[_NSControllerObjectProxy copyWithZone:]: selector not recognized
[self = 0x49723a0]
2005-12-03 19:31:59.644 Editor[7864] *** NSRunLoop ignoring
exception '*** -[_NSControllerObjectProxy copyWithZone:]: selector
not recognized [self = 0x49723a0]' that raised during posting of
delayed perform with target 38e4c0 and selector 'invokeWithTarget:'
The second time the code is run (where I simply see if the
controller has been added to the cache instead of creating a new
one), it opens and works fine.
I've searched the archives for the error message, and saw where
mmalc thought it might have to do with a copy instead of a retain
being used on one of the controllers or in a bind: method. I've
looked at all my code, and am not using copy. I do use retain.
The code I use is:
BookWindowController *windowController = [[self bookEditorCache]
objectForKey:[object objectID]];
if (windowController == nil) {
windowController = [self createCachedEditorForBook:(Book *)
object];
}
// show the window
[windowController showWindow:self];
In stepping through the code, the exception is raised when
showWindow: is called. So the two different paths are just based
around windowController being nil. I just do not understand why
the first time the window is tried to be displayed I'd get the
exception, and not on subsequent times of opening the window.
Especially as the window seems to behave properly.
Any ideas?
I think some extra info is needed. For one, are both of your
windows stored in the same nib? If they are in different nibs,
then perhaps it's something to do with the first time the nib is
instantiated. At that time, outlets, bindings, etc. will be re-
established. I would add logging to the various model objects and
object controllers you may have in your nib (adding logging to the
various initXXX APIs may be enough).
They are different NIB files. There are no initXXX methods I have
defined. Would there be particular ones that would be good to
subclass? initWithWindowNibName is the only one I directly call.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden