App Folder files not visible after un-install / re-install

后端 未结 3 433
面向向阳花
面向向阳花 2021-01-14 05:57

I noticed this in the debug environment where I have to do many re-installs in order to test persistent data storage, initial settings, etc... It may not be relevant in prod

3条回答
  •  终归单人心
    2021-01-14 06:07

    I think you are correct that it is by design.

    By inspection I have concluded that until an app places data in the AppFolder folder, Drive does not sync down to the device however much to try and hassle it. Therefore it is impossible to check for the existence of AppFolder placed by another device, or a prior implementation. I'd assume that this was to try and create a consistent clean install.

    I can see that there are a couple of strategies to work around this:

    1) Place dummy data on AppFolder and then sync and recheck.

    2) Accept that in the first instance there is the possibility of duplicates, as you cannot access the existing file by definition you will create a new copy, and use custom metadata to come up with a scheme to differentiate like-named files and choose which one you want to keep (essentially implement your conflict merge strategy across the two different files).

    I've done the second, I have an update number to compare data from different devices and decide which version I want so decide whether to upload, download or leave alone. As my data is an SQLite DB I also have some code to only sync once updates have settled down and I deliberately consider people updating two devices at once foolish and the results are consistent but undefined as to which will win.

提交回复
热议问题