views:

12

answers:

1

Hello,

In some part of my app I replace the db.sqlite file used by CoreData to store all my app data but the loaded data doesn't change. I noticed that the new data is only shown when I restart the app. Maybe someone can explain-me why this happens and how to solve it.

Thank you very much,

+1  A: 

Sounds like a caching issue. If you change stores, you should reload the Core Data stack from scratch e.g. create a new persistent store coordinator, new context etc. Otherwise the stack will assume it is using the old store. Core Data doesn't have an easy mechanism for changing stores on the fly.

TechZen