CoreData: fetching an object from an unsaved context

after I insert the ManagedObject into the context, which I would like to get later, but before saving the context (I would save after all the objects are inserted). It seems that a context request later with extraction on these objects does not return anything if the context has not been previously saved. Is there a way to save only at the end? (I think I can save my objects in an array or dictionary and query this, but I thought coredata would do this for me)

+6
iphone core-data nsmanagedobject nsmanagedobjectcontext
source share
1 answer

Try the following:

[myFetchRequest setIncludesPendingChanges:YES]; 

From the documentation :

Sets if during the selection it coincides with currently unsaved changes in the context of the managed object.

+16
source share

All Articles