Do we have to send removeObserver:
explicitly for objects that have been added as observers to an NSNotificationCenter
before?
I am bit confused and unable to find the exact answer for this.
Please provide me in detail, about this including why we need to removeObserver explicitly, and why don't compiler put it implicitly in class/application?
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.
You always need to remove observers for KVO as well as for Notifications.
Yes, you need to call
removeObserver:
, if you don't the observed class could call all deallocated instance of the observer.From 10.11 observers are not required to un-register in their deallocation method.