Reverting CoreData data

Posted by ndg on Stack Overflow See other posts from Stack Overflow or by ndg
Published on 2010-06-17T09:00:30Z Indexed on 2010/06/17 9:03 UTC
Read the original article Hit count: 299

Filed under:
|
|
|

I have an NSTableView which is populated via a CoreData-backed NSArrayController. Users are able to edit any field they choose within the NSTableView. When they select the rows that they have modified and press a button, the data is sent to a third-party webservice. Provided the webservice accepts the updated values, I want to commit those values to my persistent store. If, however, the webservice returns an error (or simply fails to return), I want the edited fields to revert to their original values.

To complicate matters, I have a number of other editable controls, backed by CoreData, which do not need to resort to this behaviour.

I believe the solution to this problem revolves around the creation of a secondary Managed Object context, which I would use only for values edited within that particularly NSTableView. But I'm confused as to how the two MOC would interact with each other.

What's the best solution to this problem?

© Stack Overflow or respective owner

Related posts about core-data

Related posts about object