Skip to content

Instantly share code, notes, and snippets.

@timd
Created September 19, 2011 13:47
Show Gist options
  • Save timd/1226528 to your computer and use it in GitHub Desktop.
Save timd/1226528 to your computer and use it in GitHub Desktop.
Extended error dump for Core Data errors
if(![managedObjectContext save:&error]) {
NSLog(@"Failed to save to data store: %@", [error localizedDescription]);
NSArray* detailedErrors = [[error userInfo] objectForKey:NSDetailedErrorsKey];
if(detailedErrors != nil && [detailedErrors count] > 0) {
for(NSError* detailedError in detailedErrors) {
NSLog(@" DetailedError: %@", [detailedError userInfo]);
}
}
else {
NSLog(@" %@", [error userInfo]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment