local storage after "killing" app on IOS

Posted by John Goodland on 24-Apr-2013 04:00

Looking for a way to keep local storage after killing the app on IOS.

My local data remains whilst the app is running in background, however if the user kills the app or reboots the phone I have lost the data. I dont want to connect to a database when launching the app only when the user submits data, so looking for things like username / password and shopping cart type thing to store locally.

All Replies

Posted by egarcia on 24-Apr-2013 06:06

Hello,

You can use the localStorage functionality in HTML5/JavaScript.

You can save and retrieve dada from localStorage by using JavaScript directly or by using the event and mapping functionality in the Mobile App Builder.

Check the following link for some information:

http://diveintohtml5.info/storage.html

I hope this helps.

Posted by John Goodland on 24-Apr-2013 06:25

thanks for the reply unfortunately IOS seems to flush this at random

"By moving localStorage to the Caches folder, they have allowed localStorage to be cleaned up whenever iOS wishes" - Which is pretty much what we are seeing on testing.

Posted by egarcia on 24-Apr-2013 07:58

Hello,

The issue that you are describing was present in iOS 5.1.

At the time, a possible workaround was to use local cookies instead of localStorage. The disadvantage of this was that cookies could disabled in the settings.

The support for this functionality is provided by the PhoneGap container.

Based on your description and some few searches with DuckDuckGo, it seems that there is an issue that is preventing the expected behavior.

In iOS 6 and later, Apple added a key called WebKitStoreWebDataForBackup to allow the storage of this data:

     https://developer.apple.com/library/ios/#releasenotes/General/RN-iOSSDK-6_0/index.html

PhoneGap added support for this key in PhoneGap 2.1.0:

     http://phonegap.com/blog/2012/09/21/phonegap-210/

However, there seems to an issue where it is not saved after the first launch of the app:

     http://stackoverflow.com/questions/9664392/phonegap-ios-5-1-and-localstorage

     https://issues.apache.org/jira/browse/CB-1535

I could not find a reference indicating where CB-1535 was included in PhoneGap.

Could you report this issue to Progress Customer Support?

Thanks.

Posted by John Goodland on 24-Apr-2013 08:14

Thanks - I will log this

This thread is closed