Skip to content

Instantly share code, notes, and snippets.

@xdream86
Created April 22, 2014 13:39
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 xdream86/11179635 to your computer and use it in GitHub Desktop.
Save xdream86/11179635 to your computer and use it in GitHub Desktop.
NSError *error = nil;
if ([self.managedObjectContext save:&error] == NO) {
NSAssert(NO, @"Save should not fail");
[self showAlert];
}
- (void)showAlert {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Could Not Save Data"
message:@"There was a problem saving your data but it is not your fault. If you restart the app, you can try again. Please contact support (support@domain.com) to notify us of this issue."
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alertView show];
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
abort();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment