I have a class with this method call within dealloc:
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
}
Where would I remove myself from the notification center once I convert the class to ARC? Should it go within viewDidUnload? The notification is used to listen for events that come from a modal view controller, so I cannot put this code into viewWillDisappear.
The dealloc
stays in ARC, it's just that you shouldn't be calling [super dealloc]
any longer: the compiler inserts the code for you. And of course all the calls to release
cannot be made in dealloc
(or anywhere else).
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
// [super dealloc]; <<== Compiler inserts this for you
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With