Reputation: 1422
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.
Upvotes: 3
Views: 164
Reputation:
I guess it returns Updated object from Context.
Note: Due to low reputation i have to put as answer.
Upvotes: 0
Reputation: 539795
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.
Upvotes: 0
Reputation: 3271
Your quote answers that question; it will be the one in memory. With that comes the caveat that if you make a new NSManagedObjectContext
and perform the fetch request on that context, you will get the object from the data store.
Upvotes: 1