I have a @class Foo
which contains a __weak id bar
ivar. Several actions from methods in different classes can cause the object to disappear and thus get bar
niled.
I want to perform an action when the ivar is automatically niled by ARC.
If possible, I would want to avoid turning bar
into a property or using Key-Value Observing.
Is this even possible? If not, can KVO be used against non-property ivars?
KVO cannot be successfully used on non-property IVARs.
You cannot detect from the runtime when Objective-C's ARC nils an IVAR.