How do I check the value of a cooke in other places in my iPhone app?
- by squeezemylime
I am setting a cookie to whether a user is logged in or not in my iPhone app. I set it using the following:
// Build the cookie.
NSHTTPCookie *cookie = [NSHTTPCookie cookieWithProperties:cookieDictionary];
// Store the cookie.
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie];
// Log the Cookie and display it
for (cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) {
NSLog(@"%@", cookie.value);
}
However, if I run this loop in other parts of the app (the 'for' loop), it isn't recognized...Is there a simple way I can find the value in other views of the app?