Local storage data getting deleted in ios 13 version in ipad devices

Hi Team, We are using following different concepts for storing the users data in the device in our hybrid mobile application and even though the app is killed or closed from background we should get the stored values, Because our app should work in offline as well. We are using below code to store. (language:jquery) 1.localStorage.put("some key", "somevalue") 2.preference.put("some key", "somevalue") 3.globalpreference.put("some key", "somevalue") 4.memorypreference.put("some key", "somevalue") And we are below code to retrive back. 1.localstorage.get("some key") 2.preference.get("some key") 3.globalpreference.get("some key") 4.memorypreference.get("some key) This concept was working 100% till iOS version 12.4.2 But this concept not working in iOS version 13.1, 13.2 The data will retain only when the app is in active state. But the stored key itself is deleted once we kill or destroyed the app from background task in iOS 13 device (iPad)and check back again. Surprisingly, Our above concept is perfectly working in Xcode 11.2 with iPad stimulator and even it will work on on real device debugging, and also for Lower version device. But when we generate the ipa and downloaded in real device, the data is getting deleted when we kill/close the application without uninstalling. But the same ipa working fine in lower version of real device. Kindly help us regarding this, because there is no code changes and we are unable to debug it because it is working as expected in stimulator. Need help on urgent basis because it is impacting our business for higher version of iPad device. Is there any work around for it?

Replies

Formatted for readability...mostly.

-=-


Hi Team, We are using following different concepts for storing the users data in the device in our hybrid mobile application and even though the app is killed or closed from background we should get the stored values, Because our app should work in offline as well.


We are using below code to store.

(language:jquery)
localStorage.put("some key", "somevalue") 
preference.put("some key", "somevalue") 
globalpreference.put("some key", "somevalue") 
memorypreference.put("some key", "somevalue")


And we are below code to retrive back.

localstorage.get("some key") 
preference.get("some key") 
globalpreference.get("some key") 
memorypreference.get("some key)


This concept was working 100% till iOS version 12.4.2 But this concept not working in iOS version 13.1, 13.2


The data will retain only when the app is in active state. But the stored key itself is deleted once we kill or destroyed the app from background task in iOS 13 device (iPad )and check back again.


Surprisingly, Our above concept is perfectly working in Xcode 11.2 with iPad stimulator and even it will work on on real device debugging, and also for Lower version device. But when we generate the ipa and downloaded in real device, the data is getting deleted when we kill/close the application without uninstalling. But the same ipa working fine in lower version of real device.


Kindly help us regarding this, because there is no code changes and we are unable to debug it because it is working as expected in stimulator.


Need help on urgent basis because it is impacting our business for higher version of iPad device. Is there any work around for it?

Any Solution?
Same problem with a Nuxt.js App and Vuex only used in Browser. Are there any solutions yet? As I read here, it wouldn't help to compile the JS in a native App :(

We are also using a similar structure. Using local store with a Vue app in mobile devices. We implemented a native iOS wrapper to store such sensitive things like user access token or some other preferences..

And implemented a two way communication between the web app and the native app, where web app can request certain things and then native app would provide a response for that request.. And with JS that seem to be working quite well..

Nowadays iOS is really aggresively killing apps due to memory issues. One easy way to reproduce this is to take a long exposure photo and notice suddenly most of your apps will be restarted when bringing the app to foreground.

So don't rely on storing crucial information you need at runtime in the web view local storage. But you can certainly rely on iOS Keychain services..

*Just to make it clear, we do not rely on local storage, but we do set certain properties in the local storage so that we can continue to test our web app in the regular desktop browser without the iOS wrapper being present. So local storage is just a fallback in case values should be provided by iOS app are not present.

Any solution? We are storing a few bits for information and it gets deleted every time.

Same here Vue JS. Works on some phones, some it doesnt. Local storage gets deleted when we close the browser.

Did you try using a Service Worker? For me the local storage works as expected. Although one case doesn't work: When I save something to the local storage BEFORE user added the web app to the home screen. The local storage somehow gets reseted with the adding to home screen. But once installed data can be stored and read beyond app closes, phone restarts, etc.