Question

In Core data , I have prepopulated some data using command line application of Mac.

After that in the application I am storing some additional data .Now the problem is whenever the application terminates the data which is not pre populated and I have stored is still there . I want it to be removed [the data which is added in application only not the prepopulated data] .

can anyone suggest me how can I do it ?

Was it helpful?

Solution

Sounds like you don't want to ever store data created inside of the application but you always want to revert to the preloaded data. If this is not correct please clarify by updating your question.

If that is correct then what I would do is add a second NSPersistentStore to the NSPersistentStoreCoordinator. The second one would be of type "In Memory". Further, I would change the options on the first store to be read-only.

With these changes the users will add objects and they will go into the in-memory store. When the application quits the in memory store is released and the changes go away.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top