I'm trying to do the following: Inside my appDelegate I'm setting a cookie. After that I'm trying to read that cookie using JavaScript from a webapp. Is this possible? Because I can't make it work...
This is my code in the iOS app:
NSMutableDictionary *cookieProperties = [NSMutableDictionary dictionary];
[cookieProperties setObject:@"test" forKey:NSHTTPCookieName];
[cookieProperties setObject:@"yes" forKey:NSHTTPCookieValue];
[cookieProperties setObject:self.siteURL forKey:NSHTTPCookieDomain];
[cookieProperties setObject:self.siteURL forKey:NSHTTPCookieOriginURL];
[cookieProperties setObject:@"/" forKey:NSHTTPCookiePath];
[cookieProperties setObject:@"0" forKey:NSHTTPCookieVersion];
[cookieProperties setObject:[[NSDate date] dateByAddingTimeInterval:9629743] forKey:NSHTTPCookieExpires];
NSHTTPCookie *cookie = [NSHTTPCookie cookieWithProperties:cookieProperties];
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie];
And in my JavaScript I'm using the jquery.cookie plugin for writing and reading cookies. But nothing is there... This is my code:
cookieValue = $.cookie("test");
alert(cookieValue);
The alert has in the body "[object Object]" and there should be the "yes" value I set in my app.
Do you guys think this is possible?
Thanks!