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

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -