• 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: Avoiding KVO in dealloc?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Avoiding KVO in dealloc?


  • Subject: Re: Avoiding KVO in dealloc?
  • From: Kyle Sluder <email@hidden>
  • Date: Mon, 3 Aug 2009 16:46:49 -0700

On Mon, Aug 3, 2009 at 4:35 PM, Todd Heberlein<email@hidden> wrote:
> Both methods seem to me to do the same thing (releasing foo), but I presume
> the first one would trigger any KVO observers where as the second wouldn't.
> Is that why the simple "release" is used instead of a setter in the dealloc
> methods, to avoid KVO? Is this a general Cocoa pattern?

Yes, it's a general pattern.  Not just to avoid KVO, but any custom
accessor/mutator behavior.

The rule of thumb is never use your accessors/mutators inside -init or
-dealloc, and always use them elsewhere.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Avoiding KVO in dealloc?
      • From: Kiel Gillard <email@hidden>
References: 
 >Avoiding KVO in dealloc? (From: Todd Heberlein <email@hidden>)

  • Prev by Date: Avoiding KVO in dealloc?
  • Next by Date: Re: Avoiding KVO in dealloc?
  • Previous by thread: Avoiding KVO in dealloc?
  • Next by thread: Re: Avoiding KVO in dealloc?
  • Index(es):
    • Date
    • Thread