On May 19, 2016, at 12:41 PM, Jens Alfke wrote: > >> On May 19, 2016, at 7:51 AM, Alex Zavatone <[email protected]> wrote: >> >> Is there a means to have an object know when it's being observed so that it >> will refuse to nuke itself in this condition? > > Nope. Remember, objects don’t “nuke” themselves; they are dealloced when no > other objects have references to them. It’s the observer’s responsibility to > retain a reference to the target object (observee?) for as long as it’s > observing that object. Or at least to have some means of detecting that the > target object is going to go away, and removing itself as an observer then. > > —Jens
OK, fair enough. Looks like I'll have build a little weak referenced dealy that subclasses dealloc and stops if it detects any observers. Then for any object that I plan on being KVOable, it will have to be be a subclass of NSObject+bubblewrappedKVO, if dealloc is called while observers are still on the object. Thank you, sir. Alex Zavatone _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
