Phonegap iOS 5.1 and localStorage
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
Localstorage cleared after restarting the application on phonegap IOS?
Starting from IOS 5.1 Apple decided to make local storage a temp area. If you need persistent storage on iOS 5.1, use PhoneGap's File API. Here are a couple links to learn about the issue.
http://community.phonegap.com/nitobi/topics/phonegapbuild_localstorage_on_ios_5_1
http://docs.phonegap.com/en/2.6.0/cordova_storage_storage.md.html#Storage
Apple discurages you from using local storage as well.
iOS PhoneGap app rejected because of the use of localStorage
localStorage cleared on app restart with Cordova 1.7 and iOS 5.1.1
Try using 1.7 - I had a similar issue and once I upgraded to 1.7 everything worked like it used to.
Try using localStorage vs window.localStorage syntax.
Also set what ever you're trying to call as a global variable...
var globalVar;
function onDeviceReady(){
globalVar = localStorage.getItem('something');
}
Phonegap (1.4.1) Storage not working anymore with iOS 5.1
There has been a Jira issue created on this: localStorage / SQLDatabase Error after App update
LocalStorage not persistent with Phonegap
are you calling somewhere window.localStorage.clear();?
LocalStorage in app being cleared on reboot in iOS8
I'm trying to find a solution too for this. It looks like localstorage is considered "unreliable" since iOS5.1. See: Phonegap iOS 5.1 and localStorage
unfortunately websql is going to be depricated, and indexdb is currently not supported in cordova (due to the fact that they use uiwebview and not wkwebview-- the new ios8 browser control that supports indexdb).
So I'm still scratching my head on this as well.
EDIT: I've been using "cordova-plugin-file" api to save/retrieve json as localstorage isn't completely reliable on ios cordova.
Related Topics
How to Save Nsmutablearray in Nsuserdefaults
Linking Objective-C Categories in a Static Library
How to Hide Tab Bar with Animation in iOS
How to Save Nsmutablearray or Nsdictionary Data as File in iOS
How to Split Filename from File Extension in Swift
How to Localize the Images in Images.Xcassets
How to Dismiss a Storyboard Popover
Uicollectionview Auto Scroll to Cell at Indexpath
Show iPhone Cut Copy Paste Menu on Uilabel
Xcode 4: Build Failed, No Issues
Add Left/Right Horizontal Padding to Uilabel
Automatic Otp Verification in iOS
Getting Text from Image on iOS (Image Processing)
How to Disable No Inverse Relationship Warning for Coredata in Xcode 4.2
The Advertisingidentifier and Identifierforvendor Return "00000000-0000-0000-0000-000000000000"
Astoryboard.Instantiateviewcontrollerwithidentifier("Myid") Returns Nil But Not Nil in Lldb