Skip to content

Instantly share code, notes, and snippets.

@aranm
Created April 21, 2013 03:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aranm/5428332 to your computer and use it in GitHub Desktop.
Save aranm/5428332 to your computer and use it in GitHub Desktop.
Make sure that you respond to notifications on the main thread
- (void)respondToNotification:(NSNotification *)notification {
if (![NSThread isMainThread]) {
[self performSelectorOnMainThread:@selector(respondToNotification:) withObject:notification waitUntilDone:YES];
return;
}
//Code here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment