When to remove the observer from NSNotificationCenter?


When to remove the registered observer from NSNotificationCenter? Would it be safe not to call removeObserver for the object like imageStore existing forever during the application lifetime?


That’s correct. Since it is a singleton that will exist for the lifetime of the application, we don’t need to unregister.

In general, I prefer to unregister in the complementary method in which I register. For example, if I register in -init, I’ll unregister in -dealloc. If I register in -viewWillAppear:, I’ll unregister in -viewWillDisappear:.


I see. Thanks a lot.