Reputation: 37581
I'm just getting started learning CoreData for iOS and have written some exploratory code to store (via ManagedObjectContext
save) and read data successfully.
However I've got lots of data in the file but want to start out again from scratch, so figured I'd just delete it manually in the file system. But what's its name/location? I can't see anything that looks like it by manually browsing around, and while I've not finished reading my book on core data yet, flicking through it I can't find any reference to this sort of information.
TIA
Upvotes: 1
Views: 6355
Reputation: 1037
Deleting simulator data for dummies:
Upvotes: 0
Reputation: 90117
The file is in the application directory of your iPhone simulator e.g. /Users/matthias/Library/Application Support/iPhone Simulator/5.0/Applications/EB33C087-A250-483E-96DD-D265ED3F0985/Documents/Foobar.sqlite
Just put a NSLog in the persistentStoreCoordinator getter to see the exact location.
Like this:
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
/* ... */
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"Foobar.sqlite"];
NSLog(@"CoreData Location: %@", storeURL);
Upvotes: 7
Reputation: 9318
You can remove your application from simulator or your iPhone/iPad/iPod and install it again. CoreData database will be cleared.
Upvotes: 3