In ARC do we need to send removeObserver: explicitly?

后端 未结 4 1489
情歌与酒
情歌与酒 2020-12-16 13:45

Do we have to send removeObserver: explicitly for objects that have been added as observers to an NSNotificationCenter before?

I am bit con

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-16 14:12

    Removing the observer is always a smart idea. If you don't remove the observer, messages will still be sent, even if the object was deallocated. It might even be attached to another object, which would definitely lead to serious trouble.

提交回复
热议问题