Does iOS 5.1 clear the localStorage when I close a

2019-03-30 09:16发布

问题:

I have an app that saves a bookmark of the readers position an put in into localStorage. When I close the App on iOS 5.1 the bookmark is gone, but on 5.0.1 it´s still there?

回答1:

Unfortunately, in iOS5.1, localstorage is considered temporary data that can be deleted at any time... But Kerri Shotts wrote a code to support NATIVE persistence of localStorage with phoneGap : http://pastebin.com/5881768B

(it will copy the localstorage file to a secure folder and restore it if necessary)

And phonegap team is working on that : https://issues.apache.org/jira/browse/CB-330



回答2:

It's a widely published misconception that closing apps on the 'multitasking bar' actually closes the application. It does no such thing - the bar simply maintains a list of recent apps.

See this post for a more in-depth discussion.