Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions Incremental Store/EncryptedStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,9 @@ + (NSPersistentStoreCoordinator *)makeStoreWithOptions:(NSDictionary *)options m

persistentCoordinator = [self coordinator:persistentCoordinator byAddingStoreAtURL:databaseURL configuration:nil options:options error:error];

if (*error)
{
NSLog(@"Unable to add persistent store.");
NSLog(@"Error: %@\n%@\n%@", *error, [*error userInfo], [*error localizedDescription]);
if (*error) {
// Returning nil will cause the error object to be thrown as intended if this method is called in Swift
return nil;
}

return persistentCoordinator;
Expand All @@ -297,14 +296,25 @@ + (NSPersistentStoreCoordinator *)coordinator:(NSPersistentStoreCoordinator *)co
}

[coordinator addPersistentStoreWithType:EncryptedStoreType configuration:configuration URL:url options:options error:error];


if (*error) {
// Returning nil will cause the error object to be thrown as intended if this method is called in Swift
return nil;
}

return coordinator;
}

+ (NSPersistentStoreDescription *)makeDescriptionWithOptions:(NSDictionary *)options configuration:(NSString *)configuration error:(NSError * __autoreleasing*)error {
NSPersistentStoreDescription *description = [NSPersistentStoreDescription new];
EncryptedStoreFileManager *fileManager = [options objectForKey:self.class.optionFileManager] ?: [EncryptedStoreFileManager defaultManager];
[fileManager setupDatabaseWithOptions:options error:error];

if (*error) {
// Returning nil will cause the error object to be thrown as intended if this method is called in Swift
return nil;
}

description.type = self.optionType;
description.URL = fileManager.databaseURL;
description.configuration = configuration;
Expand Down