Deleting persistent store will now permit using a store seed.

This commit is contained in:
Greg Combs
2011-05-01 20:49:32 -05:00
parent 81bc082a2a
commit d780586da4
2 changed files with 9 additions and 1 deletions

View File

@@ -106,6 +106,7 @@ extern NSString* const RKManagedObjectStoreDidFailSaveNotification;
* This deletes and recreates the managed object context and
* persistant store, effectively clearing all data
*/
- (void)deletePersistantStoreUsingSeedDatabaseName:(NSString *)seedFile;
- (void)deletePersistantStore;
/**

View File

@@ -172,7 +172,7 @@ static NSString* const kRKManagedObjectContextKey = @"RKManagedObjectContext";
}
}
- (void)deletePersistantStore {
- (void)deletePersistantStoreUsingSeedDatabaseName:(NSString *)seedFile {
NSURL* storeUrl = [NSURL fileURLWithPath:self.pathToStoreFile];
NSError* error;
@@ -194,9 +194,16 @@ static NSString* const kRKManagedObjectContextKey = @"RKManagedObjectContext";
[threadDictionary removeObjectForKey:kRKManagedObjectContextKey];
}
if (seedFile)
[self createStoreIfNecessaryUsingSeedDatabase:seedFile];
[self createPersistentStoreCoordinator];
}
- (void)deletePersistantStore {
[self deletePersistantStoreUsingSeedDatabaseName:nil];
}
/**
*
* Override managedObjectContext getter to ensure we return a separate context