Skip to content

Instantly share code, notes, and snippets.

@priore
Created November 12, 2014 11:15
Show Gist options
  • Save priore/1daa138d38f8cee0ff29 to your computer and use it in GitHub Desktop.
Save priore/1daa138d38f8cee0ff29 to your computer and use it in GitHub Desktop.
Tips: a solid dealloc for all classes
- (void)dealloc
{
[NSObject cancelPreviousPerformRequestsWithTarget:self];
[[NSNotificationCenter defaultCenter] removeObserver:self];
if ([self respondsToSelector:@selector(setDelegate:)])
[self performSelector:@selector(setDelegate:) withObject:nil];
[super dealloc]; // not needed in ARC
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment