mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-27 00:01:00 +08:00
Deleting persistent store will now permit using a store seed.
This commit is contained in:
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user