In a controller we have added observer in viewDidAppear
and it's removed in viewWillDisappear
. There is no observer in init/viewDidLoad
.
In such a case the below line for safety purpose/is it required in dealloc
method?
[[NSNotificationCenter defaultCenter] removeObserver:self];
Now the question/doubt is are there scenarios where dealloc
will get called without viewWillDisappear
not being called? What about when memory warnings are called. What happens in those cases?
Thanks.