Reputation: 2945
I am using Magical Record library to easily maintain my core data related project.
Here i have a situation where i have to remove all changes done to default context and prevent saving it into the database.
The problem is i am not using any method of Magical Record which performs save operation. So it is not saving into the database fine. But it maintains data in current context.
How do i clear all the changes made to current context or root context?]
Thanks, Pratik
Upvotes: 2
Views: 977
Reputation: 69727
Don't use the default context for changes you are not sure are going to eventually be persisted. The easiest way to do this is to create a new context. With MagicalRecord, creating a new context will automatically merge your changes to the default context when you save it. If you don't want to keep the changes in your new context, then just release it, along with any objects that use that contexts and those changes will be discarded. You don't have to go and manually undo everything. When you take advantage of multiple contexts, you will have a lot less work to do.
Upvotes: 3