How do I check the value of a cooke in other places in my iPhone app?

Posted by squeezemylime on Stack Overflow See other posts from Stack Overflow or by squeezemylime
Published on 2010-06-02T21:22:38Z Indexed on 2010/06/02 21:24 UTC
Read the original article Hit count: 239

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cookies