views:

110

answers:

3

Hi,

I've got a fetched results controller handling a table view, and I'm having a problem that it is also showing new managed objects that have been created in the context but not saved to the store. I only want to list objects that have been saved.

I have tried setting the setIncludesPendingChanges to NO in the fetch request but it's not working!

Any advice would be greatly appreciated!

Thanks,

Mike

A: 

I've overcome this issue by implementing a stack of managed object contexts. And when creating new records I do it in another context that I push onto the stack, and I only merge the changes if the user saves the changes.

Michael Waterfall
A: 

setIncludesPendingChanges appears to be working for me (at least in the Sim using SDK 3.1 in 3.0 mode).

Jason
A: 

The CoreDataBook example project shows a way to create a "scratch pad" context for editing (or creating a new model object) and then, once you save changes to the scratch, how to merge it up to the main or application context.

Using the scratch prevents any temporary objects created in it from showing up in the main context (until you merge the contexts at save-time).

Jason