I\'m pretty new to CoreData and this app that uses it. And I\'m currently working on a feature that clears the entire core data when I log out in the app.
I have 2 sqlli
try the following method to flush the database, it works perfect for me.
-(void) flushDatabase{
[__managedObjectContext lock];
NSArray *stores = [__persistentStoreCoordinator persistentStores];
for(NSPersistentStore *store in stores) {
[__persistentStoreCoordinator removePersistentStore:store error:nil];
[[NSFileManager defaultManager] removeItemAtPath:store.URL.path error:nil];
}
[__managedObjectContext unlock];
__managedObjectModel = nil;
__managedObjectContext = nil;
__persistentStoreCoordinator = nil;
}