Skip to content

Instantly share code, notes, and snippets.


Chris Gibbs chrisgibbs

View GitHub Profile
chrisgibbs / resetPersistentStore.m
Created Apr 27, 2012
Deletes the persistent store file and re-creates a new one.
View resetPersistentStore.m
- (void)resetPersistentStore
NSURL *storeURL = [NSURL fileURLWithPath:[[NSString documentsPath] stringByAppendingPathComponent:DatabaseFileName]];
// Remove persistent store from the coordinator
NSPersistentStore *store = [_persistentStoreCoordinator persistentStoreForURL:storeURL];
NSError *error = nil;
if (![_persistentStoreCoordinator removePersistentStore:store error:&error])
// handle error