iPhone: NSHTTPCookie is not saved across app restarts

Posted by Tom van Zummeren on Stack Overflow See other posts from Stack Overflow or by Tom van Zummeren
Published on 2010-04-18T14:27:38Z Indexed on 2010/04/18 14:33 UTC
Read the original article Hit count: 371

Filed under:
|

In my iPhone app, I want to be able to reuse the same server-side session when my app restarts. A session on the server is identified by a cookie, which is sent on each request. When I restart the app, that cookie is gone and I can't use the same session anymore.

What I noticed when I used the NSHTTPCookieStorage to look up the cookie I got from the server, is that [cookie isSessionOnly] returns YES. I get the impression that this is why cookies are not saved across restarts of my app. What would I have to do to make my cookie NOT session only? What HTTP headers do I have to send from the server?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cookies