Re: Object(s) instantiated multiple times issue
Re: Object(s) instantiated multiple times issue
- Subject: Re: Object(s) instantiated multiple times issue
- From: Camillo Lugaresi <email@hidden>
- Date: Wed, 8 Feb 2006 15:30:59 +0100
On 08/feb/06, at 05:04, David Whittle wrote:
On 2/7/06, gnat <gnat> wrote:
What i'm seeing:
The "global" object works exactly as I expect. But I am
seeing the
other objects apparently receive the notification multiple times. In
running it in debug, what I found was that self had a different
memory address each time the notification was received. Furthermore I
was getting a number of receptions equal to the number of outlets for
the object plus one (i'm guessing the object itself).
Ah the old "send a note to a mailing list and find the answer" :/
I messed up my -init methods and wasn't calling [super init] or
returning self. Once I fixed that, it now only does the init and
awakeFromNib once as expected.
It does seem odd though that it would attempt to recreate the object
rather than complain that no object was returned...
I would still appreciate feedback if there is a better way to
communicate between my objects though.
Instead of using notifications, you can connect the objects using
outlets. You could also use the singleton pattern.
Camillo
_______________________________________________
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