I have an iphone app that has a sqlite db, mapped to core data. All the data manipulation in the app is via Coredata.
On one table I wanted to add a string attribute. And I did two things both with similar crashes:
-
I tried to use Mesasql to alter the structure. I easily added a Varchar column. But it crashes.
-
On a separate attempt, with the mapped SQLlite db, restored, I tried adding a attribute to the entity in core data and it crashed.
This is the error I got:
* Terminating app due to uncaught exception of class ‘NSCFString’
terminate called after throwing an instance of ‘NSCFString’
So, how can I alter the structure of the sqlite table mapped to core data without breaking the app? Am I fogetting to do a commit or something like that?
Please help
Every time you modify an entity you have to delete the sqlite store. If your application has already shipped, the alternative is to migrate your data. This SO answer offers a simple explanation of how to do that.