Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Pre-flight saving a Core Data binary store
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