Reputation: 63
I'm working on a problem in my Mac OSX 10.5 application that requires deleting cookies on user sign-off from the application - so that a different user can sign-in without the need to quit the application. When user authenticates for the first time, the WebView receives and caches 5 cookies using the singleton cookie storage class NSHTTPCookieStorage. When I try to retrieve the cookies using [NSHTTPCookieStorage cookiesForURL:] method, I get only 4. Which means that the 5th one is associated with some other URL. I cannot use the domain to identify the cookies because I may land up deleting cookies being used by other applications. I am thinking along the following lines:
I have also tried different options provided by WebPreferences class, but that didn't help. Thanks in advance for any hints to fix this issue.
Upvotes: 3
Views: 1883
Reputation: 299633
Do you want to share cookies with Safari? If not (and I assume you don't), then look at IGIsolatedCookieWebView for an example of how to create your own private cookie store in webkit.
If you want to share cookies with Safari, you'll need to keep track of and then delete the relevant cookies at the appropriate time using NSHTTPCookieStorage
.
Upvotes: 1