How to stop deleting an HTML 5 database in iOS 5.1

This is basically the same question as this one , except that I don’t use PhoneGap (so I don’t think of the solutions offered there).

I have pure HTML / JS webapp that works offline (using WebSQL for storage and AppCache for disconnected use).

The application has an “export” option, which serializes the data as JSON and loads it into the AWS S3 bucket for backup; and the corresponding import option for recovery. However, since this is a complete dump / restore of the entire db, the process is not so fast, so I usually do backups on a weekly basis.

As expected, updating OTA from iOS 5 to 5.1 deleted my local webSQL database , but I was able to successfully recover data from S3 (fortunately, I just made a backup before the update).

Unfortunately, after a couple of weeks of working with iOS 5.1, he again decided that he needed a place and deleted my webSQL db . Again, I was fortunate that this happened right after my regular weekly backup; but I’m worried that if this becomes commonplace (iOS removes this “temporary” database to free up space), it will be shortly before I catch you without copying for several days.

I plan to eventually quit the now defunct WebSQL and use IndexedDB; but of course, iOS does not yet support IndexedDB . I also plan to change the export / import process in my application, so that instead of performing a full dump / restore, it simply synchronizes any changed records with S3 (so that the backup to S3 is smaller due to the hassle, and therefore they can be done more often, than weekly).

In the meantime, there are some hacks / workarounds / tricks to ensure that the beta version of WebSQL is not cleared by iOS 5.1 ; or is there any way that I can predict when a cleanup might happen so that I can try to unload it by doing an export to back up my data?

+4
source share
1 answer

The solutions offered by the PhoneGap community are certainly applicable. For us, the code https://issues.apache.org/jira/browse/CB-330?focusedCommentId=13237796&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13237796 worked best for us, if it was called before the initialization of any WebView (i.e., in your application init ()), and also call it after the initialization of WebView.

The linked code moves the database to a safe place and also edits WebKit settings to link to a new location. It must be run twice in order to move and update existing databases before downloading WebKit and updating to a new location after loading WebKit (since WebKit will create settings that indicate an incorrect / unsafe location)

0
source

Source: https://habr.com/ru/post/1402148/


All Articles