ios - CoreData - when do I save? -
i understand how use coredata, i'm confused when it's best save data. when press home button? on every interaction in case app crashes?
the reason why saving data separate call can batch multiple smaller changes comprise larger operation , save @ once, rather saving @ each step along way.
you should save data after each atomic operation, , never have committed data sitting in memory significant period of time.
each time user commits change data, expect data there next time run app, it's job make sure it's there.
after user submits change data, app going waiting user else anyway, save data while user decides next.
if wait save data in applicationdidenterbackground
, there no guarantee ever called.
obviously, not data critical, example, data user has entered on form, hasn't submitted, not critical. however, submitted data critical.
Comments
Post a Comment