How to get cookies to work in cordova app?

I know this is not related to framework7 as an issue, but I wonder if anybody can tell me how to get cookies to work when building a Cordova app?
Since for some reason it is not working out of the box!?
I have been testing for a couple of days and I can´t get it to work and it drives me cracy since in the app I use a lot of cookies.

And from the plugin docs it looks easy…but not for me haha.

Building a Cordova app and trying to get cookies to work so I installed the cordova-plugin-cartegraph-cookie-master plugin and when Im testing it with:

cookieMaster.setCookieValue(‘https://mydomain.se:443’, ‘userId’, ‘1’,function() {
console.log(‘A cookie has been set’);
},
function(error) {
console.log('Error setting cookie: '+error);
});
cookieMaster.getCookieValue(‘https://mydomain.se:443’, ‘userId’, function(data) {
console.log(data.cookieValue);
}, function(error) {
if (error) {
console.log('error: ’ + error);
}
});
When I try to build and run the app in my iphone from Xcode, it stops at row 59 in the CDVCookieMaster.m file.

NSHTTPCookie *cookie = [NSHTTPCookie cookieWithProperties:cookieProperties];

Thread 1: signal SIGABRT
I get no other error message so I have no idea why it is not working.

What Im I missing? Or do you know another way to get cookies to work in an Cordova app? Any input really appreciated, thanks!

I advise you to use another resource that is simpler, lighter and with the same purpose.

1 - localStorage

2- sessionStorage

I use them and it works great for me on Android and iOS :slight_smile:

1 Like

Thanks, yes I use localstorage as well, but I guess I only have to use that.