Skip to content

Instantly share code, notes, and snippets.

@MattFoley
Created June 18, 2013 21:33
Show Gist options
  • Save MattFoley/5809644 to your computer and use it in GitHub Desktop.
Save MattFoley/5809644 to your computer and use it in GitHub Desktop.
Reset Core Data
- (void)resetCoreData
{
NSArray *stores = [self.persistentStoreCoordinator persistentStores];
for(NSPersistentStore *store in stores) {
[self.persistentStoreCoordinator removePersistentStore:store error:nil];
[[NSFileManager defaultManager] removeItemAtPath:store.URL.path error:nil];
}
_persistentStoreCoordinator = nil;
_managedObjectContext = nil;
_managedObjectModel = nil;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment