Skip to content
This repository has been archived by the owner on Nov 7, 2018. It is now read-only.

[Question] Persisted data lost when moving to WKWebView #28

Closed
zarko-tg opened this issue Aug 22, 2016 · 5 comments
Closed

[Question] Persisted data lost when moving to WKWebView #28

zarko-tg opened this issue Aug 22, 2016 · 5 comments

Comments

@zarko-tg
Copy link

zarko-tg commented Aug 22, 2016

Early observation for an existing Cordova Ionic (1.3.x) app - once the app is switched over to WKWebView is seems that previously persisted data (from UIWebView) is lost. In our case we rely on localForage and angular-localForage with a default driver (asyncStorage/indexedDB). I have verified that this also applies to pure localStorage.

To begin this case I'd like to query if anyone else has noticed the same. We need to know what kind of workaround or strategy to apply in order to transition the data to the new app instance running within WKWebView.

The concern is that existing users might end up with invalidated user sessions, loss of locally stored data etc.

@zarko-tg
Copy link
Author

zarko-tg commented Aug 23, 2016

Brief update after a short check with @mhartington:
https://twitter.com/mhartington/status/768049934495080448

One possibility seems to be persisted data migration to SQLite while an app is still out there using UIWebView. Once done, a future move of the app over to WKWebView should be all good. A brief test showed that the SQLite persisted data is kept intact.

If already using localForage you might want to look at localforage-cordovasqlitedriver
(https://github.com/thgreasi/localForage-cordovaSQLiteDriver).

Likely some extra patchwork but can't tell of a better alternative so far (unless you're ok with losing already persisted data).

@danbucholtz
Copy link

@zarko-tg,

Is your app Ionic 1 or Ionic 2? We're making some changes to the storage utils in Ionic 2 to get rid of LocalStorage and to either use IndexedDB or SqlLite. It's based on local forage, so the interface should feel very familiar.

Basically, giving you a heads up so you don't invest a bunch of time and end up having to re-write something again. I think this drops in Beta 12.

Thanks,
Dan

@zarko-tg
Copy link
Author

@danbucholtz Ionic 1.

@danbucholtz
Copy link

Cool. Your best bet is going to be reading the data from LocalStorage, and then writing it back to SqlLite. You could also write to disk if that helps.

Thanks,
Dan

@zarko-tg
Copy link
Author

Cool, thanks for the ideas @danbucholtz.
You'll probably want to inform/warn the broader audience within one or another blog post on this particular (side)effect of switching already published apps over to WKWebView.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants