What happens to cookies of webview on closing the

2019-04-09 15:22发布

问题:

i am using a webview in an app which has keep me signed in functionality like facebook app.so in order to implement i need that the cookie should be persistant.I just wanted to know whether ios persists the cookie by default when the app is closed or i need to save the cookie manually before closing the app to implement keep me signed in functionality.

any help would be deeply appreciated. Thanks

回答1:

You want to use a NSHTTPCookieStorage object to manage the cookies. The short answer to your question is to use NSHTPPCookieStorage which will distribute the shared instance. You can use this instance to get/set cookie information.

Take a look at the Apple documentation for NSHTTPCookieStorage, as well as the following two posts:

Where are an UIWebView's cookies stored?

http://blog.andrewpaulsimmons.com/2008/08/add-set-and-delete-cookies-in-uiwebview.html

These should get you started down the right track.