n00bie42 n00bie42 - 3 months ago 35
iOS Question

Does Firebase realtime database sync data changed while offline to the server even after app restart?

On firebases documentation it says:

Even with persistence enabled, transactions are not persisted across
app restarts. So you cannot rely on transactions done offline being
committed to your Firebase Realtime Database. To provide the best user
experience, your app should show that a transaction has not been saved
into your Firebase Realtime Database yet, or make sure your app
remembers them manually and executes them again after an app restart.

Yet I went into my App with an iphone 6 simulator, while offline, changed some data, then switched to iphone 7 simulator to make sure 6 simulator stopped, and then went back to the 6 simulator with my internet connection now turned on, and the change I had previously made while offline synced no problem.

What problem does this documentation point to that I need to take into account. I can't afford to make something where users are frustrated with changes they thought saved getting lost, but to my eyes there is no issue?


I think the key word there is "Transactions" which are a very specific kind of write operation. (See description here).

If you're just doing a regular ol' write to the database and not sticking it inside a transaction block, your write should be saved, even across an app restart.