1

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

3 Answers 3

7

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); 
Sign up to request clarification or add additional context in comments.

Comments

3

You can remove your application from simulator or your iPhone/iPad/iPod and install it again. CoreData database will be cleared.

Comments

0

Deleting simulator data for dummies:

  1. Open finder
  2. Open Utilities
  3. Open terminal
  4. Make sure simulator is not open
  5. Type this in terminal: xcrun simctl erase all

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.