What object is returned using the recovery request in Core Data?

advertisements

Apple Documents says "If a context already contains a managed object for an object returned from a fetch, then the existing managed object is returned in the fetch results"

My Question is If I have updatd the object in the context but not saved the context yet then what object will Fetch Request return? Updated object from Context or New one from Datastore.


It depends on the includesPendingChanges setting of the fetch request. By default, includesPendingChanges is YES, which means that the fetch will get currently unsaved changes.

However, if you use the NSDictionaryResultType result type for the fetch request, this implicitly implies includesPendingChanges = NO, and you will get only results from the store.