Is there a quick way to clear all data of my CoreData without calling deleteObject for each entity in the model?
You can release all your NSPersistentStoreCoordinator
and all you NSManagedObjectContest
's then delete the file in the FS and recreate it.
Delete the persistent store on disk (after calling -[NSPersistentStoreCoordinator removePersistentStore:error:]
for any persistent store coordinator that refers to the store). You probably also want to reset any NSManagedObjectContext
instances that may have managed object instances from that store before removing and deleting the store on disk.
my experience is this doesn't work on the iPhone. the MOC creates the persistent store automatically in the simulator, but doesn't do so on the device (OS 3.1.2). Am I missing something? I thought it was a two step process: you add the persistent store, then on your first save the ManagedObjectContext creates the underlying store, via the PersistentStoreCoordinator.