Ken
Ken

Reputation: 4887

Managing coredata/sqlite database lifecycle in iOS project

I'm writing an ios app which browses(read only) a sqllite db. As the project evolves, the the db entities will change (add/modify attributes). Presumably I should get xcode to rebuild the "Managed Object class" when this happens, is that all I need to do? What about the database? How do I transition the data to the new data model?

Upvotes: 1

Views: 694

Answers (1)

yuvalz
yuvalz

Reputation: 175

From what I know, there is no way for you to control the structure of a Core Data database. Because CoreData gives you a lot of goodies - the visual object design and mapping - it needs to control the database's structure and content. That means that loading your own SQLite database and having CoreData manipulate it is impossible. You need to have core data load, manage, store all the data that is there. Core Data is ideal if it manages local data for the app, not when it needs to load a new database it did not create. For those instances, use either the native C layer of SQLite or a library like FMDB.

Upvotes: 2

Related Questions