Comments (10)
Options:
- Are you sure the plugin is correctly installed for iOS? Please retry to install the plugin again (by removing and adding it).
- If your using Ionic 2 please check the official Ionic Native docs.
- I noticed
http://localhost:8100
in your error messages. What happens when you build the binary and install it to your device or simulator rather than trying to use ionic serve or similar?
from cordova-plugin-nativestorage.
I was able to get it working. I am running into another issue. I am trying to use this plugin to do persistent login. However, the storage gets clear when the app is closed.
From: Gilles Callebaut
Reply-To: TheCocoaProject/cordova-plugin-nativestorage
Date: Tuesday, August 2, 2016 at 9:45 PM
To: TheCocoaProject/cordova-plugin-nativestorage
Cc: jttran, Author
Subject: Re: [TheCocoaProject/cordova-plugin-nativestorage] Uncaught ReferenceError: NativeStorage is not defined, http://localhost:8100/lib/ionic/js/ioni c.bundle.js, Line: 17946 (#30)
_SRP EXTERNAL WARNING: PROCEED WITH CAUTION. WHEN IN DOUBT, REPORT IT!_
Are you sure the plugin is correctly installed for iOS? Please retry to install the plugin again (by removing and adding it). If your using Ionic 2 please check the official Ionic Native docshttps://urldefense.proofpoint.com/v2/url?u=http-3A__ionicframework.com_docs_v2_native_native-2Dstorage_&d=CwMFaQ&c=akfg7FU5kpSpmm2ZSGIDmg&r=nVqS0RlVX30vkYmdV83xzLwshgnwTA1tdqLhzmddqfc&m=LROzFA51auW6ImPO7Rgss_W4wdTkD81mWjn4pF39_gQ&s=gsbzh9fwcpF-04_QkNv3qheL61A_xTxsFsJP5OGaCHY&e=.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_TheCocoaProject_cordova-2Dplugin-2Dnativestorage_issues_30-23issuecomment-2D237137113&d=CwMFaQ&c=akfg7FU5kpSpmm2ZSGIDmg&r=nVqS0RlVX30vkYmdV83xzLwshgnwTA1tdqLhzmddqfc&m=LROzFA51auW6ImPO7Rgss_W4wdTkD81mWjn4pF39_gQ&s=AiKkGTmpDrIo4h4We8-kyJ_A9atrSsKT1y6PSVwsWqs&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AE-2Db-2D-2DJZlg8OpTX5DDXE8V29zEQcukiSks5qcBzqgaJpZM4JYrJh&d=CwMFaQ&c=akfg7FU5kpSpmm2ZSGIDmg&r=nVqS0RlVX30vkYmdV83xzLwshgnwTA1tdqLhzmddqfc&m=LROzFA51auW6ImPO7Rgss_W4wdTkD81mWjn4pF39_gQ&s=9KpWoqnfCOixEkBXVFsJP1HaTxfKwFQhlNXAqhUBig8&e=.
from cordova-plugin-nativestorage.
@tranjustin are you sure the fault lies with the plugin?
- Are you storing the values correctly?
- Are you retrieving the values correctly (by using the same reference string AND the same method of storing, e.g.
getItem
only works when storing the value by means ofsetItem
,getInt
only withsetInt
,...) ? - Are you also sure that you do not invoke the
clear
method when closing the app?
from cordova-plugin-nativestorage.
@tranjustin technically the storage shouldn't be cleared. Are you seeing any error on the console?
from cordova-plugin-nativestorage.
I don’t believe it is the plugin. I got it working on the browser but not on the devices or emulators. To answer you Gilles, I am sure that I am storing and retrieving correctly from a browser perspective but don’t know what I might missed on the devices.
From: Gilles Callebaut
Reply-To: TheCocoaProject/cordova-plugin-nativestorage
Date: Wednesday, August 3, 2016 at 2:27 PM
To: TheCocoaProject/cordova-plugin-nativestorage
Cc: jttran, Mention
Subject: Re: [TheCocoaProject/cordova-plugin-nativestorage] Uncaught ReferenceError: NativeStorage is not defined, http://localhost:8100/lib/ionic/js/ioni c.bundle.js, Line: 17946 (#30)
_SRP EXTERNAL WARNING: PROCEED WITH CAUTION. WHEN IN DOUBT, REPORT IT!_
@tranjustinhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_tranjustin&d=CwMFaQ&c=akfg7FU5kpSpmm2ZSGIDmg&r=nVqS0RlVX30vkYmdV83xzLwshgnwTA1tdqLhzmddqfc&m=CAXb5wFys-y38r8N-m-OWPJ1O1FbPEyhAJGbwYuCj8E&s=5p6T9kRthaBPbkVBEXV5St95oAeCBCqZCs1VzMd9KDI&e= are you sure the fault lies with the plugin?
- Are you storing the values correctly?
- Are you retrieving the values correctly (by using the same reference string AND the same method of storing, e.g. getItem only works when storing the value by means of setItem, getInt only with setInt,...) ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_TheCocoaProject_cordova-2Dplugin-2Dnativestorage_issues_30-23issuecomment-2D237379793&d=CwMFaQ&c=akfg7FU5kpSpmm2ZSGIDmg&r=nVqS0RlVX30vkYmdV83xzLwshgnwTA1tdqLhzmddqfc&m=CAXb5wFys-y38r8N-m-OWPJ1O1FbPEyhAJGbwYuCj8E&s=edpjtubNO0RDVO6582JxP9nFPHojOkQKGs1WY5bRVV8&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AE-2Db-2D7Mkhn4hPOLXgPdVVMvEKH6hb1hkks5qcQfRgaJpZM4JYrJh&d=CwMFaQ&c=akfg7FU5kpSpmm2ZSGIDmg&r=nVqS0RlVX30vkYmdV83xzLwshgnwTA1tdqLhzmddqfc&m=CAXb5wFys-y38r8N-m-OWPJ1O1FbPEyhAJGbwYuCj8E&s=vVJLMqUkhBXEsiSIRrvaiNgi8aw4jxpI8SPeRfPQhQA&e=.
from cordova-plugin-nativestorage.
@tranjustin by browser, do you mean the browser platform
?
from cordova-plugin-nativestorage.
Can you please show us the code which should store and retrieve the values? And please do explain how you build, on the devices/browser?
And another 'question' can you please explain in this thread how you've solved the 'Uncaught referenceError
' for future cases? Some people can come to the same issue in the future :)
from cordova-plugin-nativestorage.
function loadUserCredentials() {
return $q(function(resolve,reject){
$log.log("load credential");
var storedToken = $cordovaNativeStorage.getItem(LOCAL_TOKEN_KEY).then(function(value){
$log.log("success load");
$log.log(value);
}, function(error){
$log.log("error load");
$log.log(error.message);
});
var authorizationStatus = storedToken.$$state;
if (storedToken && authorizationStatus.status == 1) {
var authorizationData = authorizationStatus.value;
useCredentials(authorizationData);
$log.log(authorizationData);
resolve(authorizationData);
}
reject();
});
}
function storeUserCredentials(authenticationData, keepmelogin) {
var defer = $q.defer();
if(!keepmelogin){
authenticationData.refresh_token = "";
}
authenticationData.keepmelogin = keepmelogin;
$cordovaNativeStorage.setItem(LOCAL_TOKEN_KEY, authenticationData).then(function(value){
$log.log("success store");
$log.log(value.name);
}, function(error){
$log.log("error store");
$log.log(error.exception);
});;
useCredentials(authenticationData);
}
Those two methods are in service that I call on $scope.$on('$ionicView.enter', function (){..}). When I deployed using Xcode I see this message “Resetting plugins due to page load”. Unfortunately, I didn’t see any error. I see the error string I logged but I don’t see the properties of the actual error I got back. I have tried error.exception and error.message. Do you know the properties inside the error that returns back?
[cid:FC409250-3A41-4311-B524-3FA1B68D3A95]
From: Gilles Callebaut
Reply-To: TheCocoaProject/cordova-plugin-nativestorage
Date: Wednesday, August 3, 2016 at 2:34 PM
To: TheCocoaProject/cordova-plugin-nativestorage
Cc: jttran, Mention
Subject: Re: [TheCocoaProject/cordova-plugin-nativestorage] Uncaught ReferenceError: NativeStorage is not defined, http://localhost:8100/lib/ionic/js/ioni c.bundle.js, Line: 17946 (#30)
_SRP EXTERNAL WARNING: PROCEED WITH CAUTION. WHEN IN DOUBT, REPORT IT!_
Can you please show us the code which should store and retrieve the values? And please do explain how you build, on the devices/browser?
And another 'question' can you please explain in this thread how you've solved the 'Uncaught referenceError' for future cases? :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_TheCocoaProject_cordova-2Dplugin-2Dnativestorage_issues_30-23issuecomment-2D237381534&d=CwMFaQ&c=akfg7FU5kpSpmm2ZSGIDmg&r=nVqS0RlVX30vkYmdV83xzLwshgnwTA1tdqLhzmddqfc&m=Q6edWYEO_CfOY06O4dne2aGolfaeXMdjW74yd0RcwDA&s=ir1Osxt8M4Z9hNT-O4TqMbzF-xeqr6VXcmwytXULElI&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AE-2Db-2D6E9dBARZpVf3QwrEH9dr169UzjUks5qcQlNgaJpZM4JYrJh&d=CwMFaQ&c=akfg7FU5kpSpmm2ZSGIDmg&r=nVqS0RlVX30vkYmdV83xzLwshgnwTA1tdqLhzmddqfc&m=Q6edWYEO_CfOY06O4dne2aGolfaeXMdjW74yd0RcwDA&s=z8xGQg_rIkAdk5NgRNai6elDHixoX-FxWEDfMLgxjkE&e=.
from cordova-plugin-nativestorage.
I forgot to mention I solved the "Uncaught referenceError” by upgrading ngcordova and this is the script I put in the index.html
<script type="text/javascript"> angular.element(document).ready(function () { if (window.cordova) { console.log("Running in Cordova, will bootstrap AngularJS once 'deviceready' event fires."); document.addEventListener('deviceready', function () { console.log("Deviceready event has fired, bootstrapping AngularJS."); angular.bootstrap(document.body, ['starter']); }, false); } else { console.log("Running in browser, bootstrapping AngularJS now."); angular.bootstrap(document.body, ['starter']); } }); </script>From: Gilles Callebaut
Reply-To: TheCocoaProject/cordova-plugin-nativestorage
Date: Wednesday, August 3, 2016 at 2:34 PM
To: TheCocoaProject/cordova-plugin-nativestorage
Cc: jttran, Mention
Subject: Re: [TheCocoaProject/cordova-plugin-nativestorage] Uncaught ReferenceError: NativeStorage is not defined, http://localhost:8100/lib/ionic/js/ioni c.bundle.js, Line: 17946 (#30)
_SRP EXTERNAL WARNING: PROCEED WITH CAUTION. WHEN IN DOUBT, REPORT IT!_
Can you please show us the code which should store and retrieve the values? And please do explain how you build, on the devices/browser?
And another 'question' can you please explain in this thread how you've solved the 'Uncaught referenceError' for future cases? :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_TheCocoaProject_cordova-2Dplugin-2Dnativestorage_issues_30-23issuecomment-2D237381534&d=CwMFaQ&c=akfg7FU5kpSpmm2ZSGIDmg&r=nVqS0RlVX30vkYmdV83xzLwshgnwTA1tdqLhzmddqfc&m=Q6edWYEO_CfOY06O4dne2aGolfaeXMdjW74yd0RcwDA&s=ir1Osxt8M4Z9hNT-O4TqMbzF-xeqr6VXcmwytXULElI&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AE-2Db-2D6E9dBARZpVf3QwrEH9dr169UzjUks5qcQlNgaJpZM4JYrJh&d=CwMFaQ&c=akfg7FU5kpSpmm2ZSGIDmg&r=nVqS0RlVX30vkYmdV83xzLwshgnwTA1tdqLhzmddqfc&m=Q6edWYEO_CfOY06O4dne2aGolfaeXMdjW74yd0RcwDA&s=z8xGQg_rIkAdk5NgRNai6elDHixoX-FxWEDfMLgxjkE&e=.
from cordova-plugin-nativestorage.
Fix by using this script in index.html
angular.element(document).ready(function () {
if (window.cordova) {
console.log("Running in Cordova, will bootstrap AngularJS once 'deviceready' event fires.");
document.addEventListener('deviceready', function () {
console.log("Deviceready event has fired, bootstrapping AngularJS.");
angular.bootstrap(document.body, ['starter']);
}, false);
} else {
console.log("Running in browser, bootstrapping AngularJS now.");
angular.bootstrap(document.body, ['starter']);
}
});
from cordova-plugin-nativestorage.
Related Issues (20)
- Ionic 3 - No provider for NativeStorage HOT 1
- Values not consistent HOT 1
- IOS doesn't work HOT 6
- getItem returns JSON_ERROR trying to get a value stored using objective c
- losing data on ios HOT 5
- retrieving data from another app HOT 1
- How can i get value from NativeStorage.getString() Without Using Callbacks? HOT 1
- Undefined data in iOS when trying to store data
- NativeStorage.keys func returns un known keys by default on IOS
- Angular Cordova app stucks at splash screen on iOS 13+ HOT 1
- Please, close this issue.
- Ionic Native Storage not working Android 9+ HOT 5
- Is this project being maintained? HOT 2
- MFP v8.o Push Rest Service Implementation sample java project or adapter HOT 1
- IOS build issue HOT 1
- Migrate data to React Native HOT 2
- Experience slow in ionic native storage in android version(sharedpreferences)
- iOS - setItem function always returns the wrong callback (Error storing item)
- Outdated values after installing new version of the app
- iOS - Privacy Manifest
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-nativestorage.