IPhone app with CoreData
I am planning to create an iphone application that uses CoreData. There may be improvements added later as new versions of the application. My question is: When using CoreData, what factors should be considered to ensure that the user is updating the version, their previous data remains intact? As I heard we have to keep the name of the .sqlite file the same. What other factors should I consider when releasing Core Data applications?
Thank.
source to share
Data migration concepts are important to understand if you intend to maintain it over time, as you will likely want to change at least a few things.
Ideal Easy migration , where minor conversions from the old data model to the new one are done automatically. As noted in the doc, it can take care of itself if your changes:
- Simple adding a new attribute
- Optional attribute becomes optional
- An optional attribute becomes optional and defines a default value
Renaming an object or attribute is also easy and almost automatic.
Everything except this - new or deleted objects, new or deleted or changed relationships - are hairier. It's not incredibly difficult, but it definitely works more and has more room to fail.
Thus, a little guesswork about the likely potential changes can make it easier and more efficient to provide little room for maneuver in advance. Obviously, if you're doing too much, especially with theoretical but currently unused relationships, you're probably slowing down the current system, and perhaps for no reason.
It is worth considering.
source to share
One thing we did was manage two separate underlying databases. First, a read-only master database that comes with app updates (assuming you want to send data using the app, if not then don't worry about that part). Second, the local underlying database (data store) that is stored on the phone, which is first populated with data from the first, and then added by the user or with updates from the server that you manage. This second master data store can remain constant between updates.
For later modifications and updates, you have two options. You can add additional functionality to the new master data store if you don't need to fetch the new data at the same time as the old data. Another option is to use the Apple Kernel Data Transfer material which you can read here here .
Finally, if you are planning to significantly add / change your main data store, I would suggest looking into SQLite. This is easier to change with updates (in my experience) than migrating an existing master data store to a new schema, especially if the schema changes frequently.
source to share