Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What object is returned by using Fetch Request in Core Data?

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.

like image 947
Bhavesh Avatar asked Mar 03 '26 08:03

Bhavesh


1 Answers

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.

like image 104
paulrehkugler Avatar answered Mar 05 '26 21:03

paulrehkugler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!