Вопрос

The app I'm working on at the moment has a read-only Core Data library full of questions (for kids to answer) that I'd like the freedom to quickly replace via app updates (ideally just by replacing the sqlite backend database in the user's documents folder if it's different to the version in the application bundle).

I'm also storing data created by the user that I don't want to lose when I replace the question database.

Is it feasible (and good practice) to have two persistent stores and data models in the same app, one which I can replace and one that remains, er, persistent through updates?

Это было полезно?

Решение

Yes. You can just have two separate Core Data stacks (two persistent stores, managed object models, and managed object contexts). Doing anything to one should not affect the other. If you want, they can also share the same managed object model, but it may be simpler to keep two separate ones if the two stores are completely independent.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top