Created
January 9, 2016 07:59
-
-
Save jazzz13/f5073176973e83e279df to your computer and use it in GitHub Desktop.
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
- (void)cleanAndResetupDB | |
{ | |
[MagicalRecord cleanUp]; | |
NSString *dbStore = [MagicalRecord defaultStoreName]; | |
NSURL *storeURL = [NSPersistentStore MR_urlForStoreName:dbStore]; | |
NSURL *walURL = [[storeURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"sqlite-wal"]; | |
NSURL *shmURL = [[storeURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"sqlite-shm"]; | |
for (NSURL *url in @[storeURL, walURL, shmURL]) { | |
if ([[NSFileManager defaultManager] fileExistsAtPath:url.path]) { | |
[[NSFileManager defaultManager] removeItemAtURL:url error:nil]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment