views:

62

answers:

2

Hey gang. I have an iphone app up on the store which uses core data. Now, every time I change something in my code with relation to core data, namely my managedobjectmodel or my model classes, I have to wipe all my data since I get a persistent store error.

Now I'm finding i need to make changes to my app and I don't want my users to lose all their data. What do I do? This is my frist foray into Core Data so any help is appreciated. Thanks.

+2  A: 

You need to version your data model. Check out Xcode > Design > Data Model. Then you need to migrate the data to the new model. This can get complicated depending on the changes.

Try this documentation.

gerry3
A: 

Never mind. It's versioning and migration that I need to look into, no bother.

monotreme
Also do not forget that Core Data on the iPhone has automatic migration for simple changes. Just need to turn it on in the options dictionary of the `NSPersistentStoreCoordinator` when you add `NSPersistentStore` instances to it.
Marcus S. Zarra