• 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: Object(s) instantiated multiple times issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Object(s) instantiated multiple times issue (From: gnat <email@hidden>)
 >Re: Object(s) instantiated multiple times issue (From: David Whittle <email@hidden>)

  • Prev by Date: [CORE DATA] batch faulting is very efficient, but...
  • Next by Date: Re: subclassing a window
  • Previous by thread: Re: Object(s) instantiated multiple times issue
  • Next by thread: Custom cell mouse tracking in an NSTableView?
  • Index(es):
    • Date
    • Thread