• 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: KVO can be unsafe in -init?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KVO can be unsafe in -init?


  • Subject: Re: KVO can be unsafe in -init?
  • From: Dave Keck <email@hidden>
  • Date: Wed, 9 Sep 2009 00:21:03 -1000

> What do I use. Normally a class static, provided that's granular enough,
> always has been for me thus far. Either just make some static thing like a
> character array and take the address of it or, as I've been doing
recently,
> use the address of the class object which I grab in a +initialize() method
> (taking care again to check I'm not being called for a subclass) and stuff
> into a static I kept for the
> purpose.

Personally, for my KVO contexts, I use:

   static void *const MyClass_KVOContext = (void *)&MyClass_KVOContext;

I've never seen anyone else use it, but I find it to be the cleanest
solution - although it certainly looks strange at first glance. :)
_______________________________________________

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: KVO can be unsafe in -init?
      • From: Keith Duncan <email@hidden>
References: 
 >KVO can be unsafe in -init? (From: John Chang <email@hidden>)
 >Re: KVO can be unsafe in -init? (From: Graham Cox <email@hidden>)
 >Re: KVO can be unsafe in -init? (From: John Chang <email@hidden>)
 >Re: KVO can be unsafe in -init? (From: Roland King <email@hidden>)

  • Prev by Date: Re: KVO can be unsafe in -init?
  • Next by Date: Re: KVO can be unsafe in -init?
  • Previous by thread: Re: KVO can be unsafe in -init?
  • Next by thread: Re: KVO can be unsafe in -init?
  • Index(es):
    • Date
    • Thread