Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You cannot roll back only a partial change set of an <code>NSManagedObjectContext</code>. The best way to do what you're talking about is to make a new <code>NSManagedObjectContext</code> that is a child of a parent context. When you save it, the changes get pushed to the parent (you have to make sure that you save your parent contexts to actually persist to disk). Additionally, if you isolate change sets in this manner, you don't even have to call <code>rollback</code> on the child contexts, you can just throw them away.</p> <p>Note that to use the parent/child relationships of the <code>NSManagedObjectContext</code> you must the <code>initWithConcurrencyType:</code> method to initialize all your contexts, and you must specify either <code>NSPrivateQueueConcurrencyType</code> or <code>NSMainQueueConcurrencyType</code>. It is important to note that this has implications on how you access the context. If you are not on the main queue using a context with a concurrency type of <code>NSMainQueueConcurrencyType</code>, you will have to put all method calls that interact with the context inside a block and pass it to the contexts <code>performBlock:</code> or <code>performBlockAndWait:</code> method.</p> <p>The documentation is rather thin on this topic. The only reference I can find outside of WWDC videos is in <a href="http://developer.apple.com/library/ios/releasenotes/DataManagement/RN-CoreData/index.html" rel="nofollow">this iOS 5 release notes document</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload