> > Is there any safer KVO technique to prevent or detect the dreaded "An > instance of xxxxxx was deallocated while key value observers were still > registered with it"? > I have a ton of observers in NSViewController subclasses. Generally when I use an observer I make 100% sure I have a strong property reference (held by the NSViewController instance) to the observed object. That way I know that the observed object will live as long as the NSViewController. That way the observed object can get deallocated before the observer. I then always make sure to remove my observers in NSViewController -dealloc.
If you want the observer to stop observing on command then use a delegate pattern or a notification to explicitly request that. It is a futile task IMHO to dig into the KVO machinery and try and second guess it. Jonathan _______________________________________________ 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]
