Load into CoreData
I have created a window based application with the coredata framework included. I have edited my xcdatamodel, created a new entity, defined attributes and generated the managed object class file. When I now try to run my application, my app crashes in the simulator with this error: The model used to open the store is incompatible with the one used to create the store"; I h开发者_JAVA百科ave no sqlite db in my project. Now my question is how to add data to coredata and get rid of this error! i understand coredata comes with its own db generated at runtime, how can I access that?
To get rid of this error:
- start the iPhone simulator
- un-install the app by clicking it and holding the mouse button for a few seconds (just like you would uninstall an app on your iPhone)
- re-install + run the app again from XCode
You get this error whenever you changed something in your data model (added attributes / entities etc.). If you want to know how to keep your data when changing the data model, you should google for "CoreData versioning".
精彩评论