Skip to content

Instantly share code, notes, and snippets.

View chrisgibbs's full-sized avatar

Chris Gibbs chrisgibbs

View GitHub Profile
@chrisgibbs
chrisgibbs / resetPersistentStore.m
Created April 27, 2012 21:24
Deletes the persistent store file and re-creates a new one.
- (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