And what does writing it's length to console show?
And what does writing it's length to console show?
The variable in local storage shows as empty. The console just shows a bunch of errors for length.
App successfully registered with Appery.io Push service
processMessage failed: Error: TypeError: Cannot read property 'length' of undefined
processMessage failed: Stack: TypeError: Cannot read property 'length' of undefined
at file:///android_asset/www/startScreen.js:282:54
at Object.cordova.callbackFromNative (file:///android_asset/www/files/resources/lib/cordova.js:294:48)
at processMessage (file:///android_asset/www/files/resources/lib/cordova.js21)
at androidExec.processMessages (file:///android_asset/www/files/resources/lib/cordova.js13)
at instrumentedCode (http://debug.appery.io/target/target-...)
processMessage failed: Message: F07 PushNotification734312673 sInvalid action
processMessage failed: Error: TypeError: Cannot read property 'length' of undefined
processMessage failed: Stack: TypeError: Cannot read property 'length' of undefined
at eval (eval at (file:///android_asset/www/files/resources/lib/jquery/jquery-2.1.1.js:330:5), :787:54)
at Object.cordova.callbackFromNative (file:///android_asset/www/files/resources/lib/cordova.js:294:48)
at processMessage (file:///android_asset/www/files/resources/lib/cordova.js21)
at androidExec.processMessages (file:///android_asset/www/files/resources/lib/cordova.js13)
at instrumentedCode (http://debug.appery.io/target/target-...)
processMessage failed: Message: F07 PushNotification734312674 sInvalid action
Can you try setting the LSV to an empty string before calling the API.
localStorage.setItem('outpan_item_name', ''); // We set the LSV to an empty string
var oitname = localStorage.getItem('outpan_item_name'); // Now just read the LSV
console.log(oitname.length); // Write it's length to the console for testing. it should be zero
If you are still getting that error then it sure is something weird that may need you to look beyond the variable declaration and API calls. It could be a bug or something is broken in your project.
I also have this doubt that the LSV was never set before? Why not try setting it to empty string instead of nothing.