I am referring to the following question: Delete/Reset all entries in Core Data?
Sometimes upon startup, I would like to clear out my Core-Data database and re-download it all over again. I am just starting to use Core Data so I am a beginner in Core Data.
1) The answers shows:
NSPersistentStore *store = ...;
How would I get the NSPersistentStore? My App Delegate does not refer to the NSPersistentStore, only to the NSStorePersistentCoordinator.
2) Am I supposed to rebuild the stack after I run the following (in the answer)?
NSPersistentStore *store = ...;
NSError *error;
NSURL *storeURL = store.URL;
NSPersistentStoreCoordinator *storeCoordinator = ...;
[storeCoordinator removePersistentStore:store error:&error];
[[NSFileManager defaultManager] removeItemAtPath:storeURL.path error:&error];
If so, how do I rebuild the stack? Can I just call one function to do that?
Thanks,