Phonegap iOS 5.1 and localStorage

安稳与你 提交于 2019-11-27 03:51:49

There was a large thread in the phonegap group that talked about this problem. Basically its because they now treat localStorage as a temp item which can be deleted at any point. Never fear there are very smart people at work!

here's the thread - https://groups.google.com/forum/?fromgroups#!topic/phonegap/RJC2qA9sDnw

here's the code - http://pastebin.com/5881768B

Lakshman Prasad

In iOS 5, localstorage was made persistent by default, by Apple. In iOS 5.1, localstorage was made a temporary folder that could be deleted by the OS any time storage was constrained. In iOS 6, localstorage was made an optionally persistent folder with a flag in the setting.

Phonegap 2.0 targeted iOS 5.1 and provided a plugin mechanism to provide persistence even though iOS did not.

With iOS 6 and phonegap 2.1 attempt was made to use the plugin only if the iOS version is 5.1 and fall back to the iOS native mechanism for persisting the folder.

However there is a bug with this fix, on iOS 6, where the localstorage folder gets deleted the first time, the data is stored: https://issues.apache.org/jira/browse/CB-1535 The bug report also has the patch; however it is not yet scheduled to be a part of any of the PhoneGap release version; so you would have to manually apply the patch.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!