ios - Clearing a context in Core Data: reset vs deleting registered objects? -
i looking posts regarding this, don't understand... difference between:
[context reset];
and:
for (nsmanagedobjectid *objid in objectids) { [context deleteobject:[context objectwithid:objid]]; }
or equivalent?
thanks
using reset
puts managed object context state in when first created it-- before had performed fetches, created new objects, etc. if have managed objects in memory fetched context, they're unusable. using reset
does not affect persistent store file. instances still exist afterward, they're not in memory. can fetched again.
using deleteobject
removes object persistent store. not exist more. can't fetched anymore because doesn't exist.
Comments
Post a Comment