Properties in dealloc: release then set to nil? or simply release

后端 未结 3 1270
醉酒成梦
醉酒成梦 2020-12-09 22:06

I\'m new to Objective-C (and stackoverflow) and I\'m a little turned around about best practices with regards to properties.

My understanding is that when you\'re c

3条回答
  •  一向
    一向 (楼主)
    2020-12-09 22:44

    @Dave DeLong: When the dealloc method of an object is performed, the object is no longer being used. All kvo observers should be removed by that moment, otherwise a waning will be dropped. And anyways - even IF an observer would see the change the object would still exist (at least partially).

    The overridden accessor is the right argument I think. However, for your own classes it might still be simpler to use the accessor. Especially when using synthesized methods, where you know the semantics but no details about the accessor...

提交回复
热议问题