Created
September 29, 2010 08:20
-
-
Save jchatard/602452 to your computer and use it in GitHub Desktop.
Debug CoreData context save errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSError* error; | |
if(![context 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