Created
September 12, 2012 11:15
-
-
Save mikeabdullah/3706001 to your computer and use it in GitHub Desktop.
Pre-flight saving a Core Data binary store
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
NSNumber *writable; | |
if ([storeURL getResourceValue:&writable forKey:NSURLIsWritableKey error:outError]) | |
{ | |
if ([writable boolValue]) | |
{ | |
return [context save:outError]; | |
} | |
else if (outError) | |
{ | |
// Generic error. NSError takes care of supplying a nice generic message to go with it | |
*outError = [NSError errorWithDomain:NSCocoaErrorDomain | |
code:NSFileWriteNoPermissionError | |
userInfo:nil]; | |
} | |
} | |
return NO; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment