FROM : Serge Meynard
DATE : Mon Apr 11 00:45:13 2005
> Serge,
>
>> I see no obvious reason why init would get called twice, and why two
>> different document objects would seem to be used at the same time.
>
> Watching it through the debugger shows that init is called, then
> makeWindowControllers, and then init again. This is why it is making
> two objects.
But what method is calling init in each case? What code do you have in
makeWindowControllers: ?
>> I'm assuming that [self updateUI] does stuff with the outlets in your
>> main window. This won't work, since the outlets have not been
>> connected
>> yet; you should move that call to the windowControllerDidLoadNib:
>> method. That might fix it...
>
> I put [self updateUI] in awakeFromNib but this does not stop the
> double init.
>
> If I move the allocation and initialization of the array to
> awakeFromNib I create only one array but when I go to save it with
> dataRepresentationOfType it says that the array is null.
Your document object isn't being loaded from a nib file, so
awakeFromNib: is not getting called. Like I said above, I think the
method you want is windowControllerDidLoadNib:.
> Like I said before I'm pretty new at this but it seems like things in
> dataRepresentationOfType and dealloc for myDocument have different
> objects for the same names that work differently in the rest of the
> program. So this has me pretty stumped.
If you look at "self" in the debugger, I have a feeling you'll find
that the "artworks" objects are not the same because the document
objects are not the same.
DATE : Mon Apr 11 00:45:13 2005
> Serge,
>
>> I see no obvious reason why init would get called twice, and why two
>> different document objects would seem to be used at the same time.
>
> Watching it through the debugger shows that init is called, then
> makeWindowControllers, and then init again. This is why it is making
> two objects.
But what method is calling init in each case? What code do you have in
makeWindowControllers: ?
>> I'm assuming that [self updateUI] does stuff with the outlets in your
>> main window. This won't work, since the outlets have not been
>> connected
>> yet; you should move that call to the windowControllerDidLoadNib:
>> method. That might fix it...
>
> I put [self updateUI] in awakeFromNib but this does not stop the
> double init.
>
> If I move the allocation and initialization of the array to
> awakeFromNib I create only one array but when I go to save it with
> dataRepresentationOfType it says that the array is null.
Your document object isn't being loaded from a nib file, so
awakeFromNib: is not getting called. Like I said above, I think the
method you want is windowControllerDidLoadNib:.
> Like I said before I'm pretty new at this but it seems like things in
> dataRepresentationOfType and dealloc for myDocument have different
> objects for the same names that work differently in the rest of the
> program. So this has me pretty stumped.
If you look at "self" in the debugger, I have a feeling you'll find
that the "artworks" objects are not the same because the document
objects are not the same.
| Related mails | Author | Date |
|---|---|---|
| David Rocamora | Apr 10, 19:58 | |
| Serge Meynard | Apr 10, 20:30 | |
| David Rocamora | Apr 10, 22:03 | |
| Shawn Erickson | Apr 10, 22:23 | |
| David Rocamora | Apr 10, 22:56 | |
| Serge Meynard | Apr 11, 00:00 | |
| David Rocamora | Apr 11, 00:34 | |
| Serge Meynard | Apr 11, 00:45 | |
| David Rocamora | Apr 11, 01:22 | |
| Serge Meynard | Apr 11, 01:59 | |
| mmalcolm crawford | Apr 11, 03:37 | |
| David Rocamora | Apr 11, 18:01 |






Cocoa mail archive

