My app must take care of “dangling information” after a Firebase Nameless Person restores an iPhone from iCloud. They’re logged out of their Firebase account however their app information are routinely restored.
When an iPhone person upgrades their telephone and restores the complete telephone content material from iCloud, their native information for every app get restored. Nonetheless, in the event that they’ve logged in anonymously with firebase, their authentication token will not be transferred to their new telephone.
That may depart the app in a wierd state: on first launch, Firebase will suppose it is a model new person, however the app’s native information are that of an present person.
Think about a photograph app. A Firestore database holds filenames of native images. When an nameless person upgrades their iPhone to a more recent model, their images are restored routinely from iCloud, however they’re logged out of their Firebase account. That leaves every of their information with out a reference, and so they’ll see an empty app with no images, and a number of wasted storage.
There are probably analogous examples on Android.
Is there any suggestions on easy methods to deal with this? I’ve some concepts, however none appear ultimate:
- Detect a restore-from-iCloud occasion (of which there are a couple of strategies) and routinely delete all native knowledge earlier than recreating a brand new nameless account
- Exclude giant information from iCloud backup (e.g. this technique)
- Frequently seek for and clear up dangling information (fixing this case and others I’ll haven’t but foreseen)
I am tempted to go for (3) however curious if there are commonplace options right here. I might particularly be curious if there is a technique to preserve all knowledge in these instances, however I doubt that is attainable with nameless accounts.