I get
TypeError: Result of expression 'localStorage' [null] is not an object
when I try access to localStorage on Symbian/Phonegap app Looks like this related to error that ocurr before:
TypeError: Result of expression 'window.widget.preferenceForKey' [undefined] is not a function. that ocurr in line
var pref = window.widget.preferenceForKey(Storage.PREFERENCE_KEY);
function Storage() {
this.available = true;
this.serialized = null;
this.items = null;
if (!window.widget) {
this.available = false;
return;
}
var pref = window.widget.preferenceForKey(Storage.PREFERENCE_KEY);
//storage not yet created
if (pref == "undefined" || pref == undefined) {
this.length = 0;
this.serialized = "({})";
this.items = {};
window.widget.setPreferenceForKey(this.serialized, Storage.PREFERENCE_KEY);
} else {
this.serialized = pref;'({"store_test": { "key": "store_test", "data": "asdfasdfs" },})';
this.items = eval(this.serialized);
}
}
It seems that I need to resolve local storage I don `t know how to do it. Any workaround?
I have actually struggled with this problem myself.
A simple work around is to avoid preferenceForKey all together and instead use preference.
You can the retreive this information later.
Hope this helps!