Reputation: 1472
My macOS application is a mess right now. I made some big changes to my Core Data model, and now, just launching the app causes the app and Xcode to crash. The app's crash log reveals the following reason for the crash:
Fatal error: Unresolved error Error Domain=NSCocoaErrorDomain Code=134140 "Persistent store migration failed, missing mapping model."
I don't want to create a mapping model. I don't care about the old CoreData model. I want all that data to go away. I have tried the following things:
~/Library/Application Support/APP_NAME/
folder.NSBatchDeleteRequest
to delete all the entities.I want to start fresh (without creating a completely new project). What do I need to do to start all over again with a fresh Core Data dataset ?
Upvotes: 5
Views: 5452
Reputation: 3773
Well if you are using the emulator, simply delete all data on it like so:
Upvotes: 2
Reputation: 13
Well, like @Willeke said, it seems to be as simple as finding the sqlite file and deleting it. That gets you a complete purge/reset without rebuilding the app. Still a pain though if you just want to tweak the structure a bit without losing the accumulated data. So for that scenario, maybe develop an export function first, dump the data, delete the sqlite file, then re-import the data.
Upvotes: 1
Reputation: 15589
Search in the Finder for yourAppName.sqlite. I found one in
~/Library/Containers/yourcompany.yourAppName/Data/Library/Application Support/yourAppName/
Upvotes: 8