Dealloc with Notifications


#1

Hi,

I do not understand the last section 24.5

e.g.
(Unfortunately, I have the German book, so my translation may not be correct)

The book says: It has been agreed, that notification centers don’t own the observers (OK, understood)

If an object is an observer, it wil usually remove itself from the notification center via its dealloc method :

  • (void)dealloc
    {
    [[NSNotificationCenter defaultCenter] removeObserver: self];
    }

Now, do I have to implement this dealloc method every time I register an object as an observer or is it deallocated and removed automatically as a standard ?

Thanks for clarification!

Klaus