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
I use this function in the AppDelegate of one of my apps...
- (void)deleteAllCoreData
{
NSPersistentStore *store = self.persistentStoreCoordinator.persistentStores[0];
NSError *error;
NSURL *storeURL = store.URL;
NSPersistentStoreCoordinator *storeCoordinator = self.persistentStoreCoordinator;
[storeCoordinator removePersistentStore:store error:&error];
[[NSFileManager defaultManager] removeItemAtPath:storeURL.path error:&error];
__persistentStoreCoordinator = nil;
__managedObjectContext = nil;
__managedObjectModel = nil;
[self addDefaultData];
}
It deletes the persistent store that CoreData uses and leaves it so that a new one is set up when core data is accessed again.
This is the method described in the second link you provided.