Skip to content

Instantly share code, notes, and snippets.

@quellish
Created August 9, 2014 20:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quellish/2bb54c9d809f1c37155b to your computer and use it in GitHub Desktop.
Save quellish/2bb54c9d809f1c37155b to your computer and use it in GitHub Desktop.
Asynchronous fetch with an NSFetchedResultsController
[[[self fetchedResultsController] managedObjectContext] performBlock:^{
NSError *fetchError = nil;
if (![self fetchedResultsController] performFetch:&fetchError]){
/// handle the error. Don't just log it.
} else {
// Update the view from the main queue.
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[tableView reloadData];
}];
}
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment