Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cookies/State of Cocoa WebView not being preserved

Having a few issues with my current build of PandoraMan (http://github.com/zquestz/PandoraMan). Everything is functional for the most part, window position is being saved, all essential functionality works, however I am seeing one bug.

When I login to Pandora, it never gets preserved. I was under the assumption that it read the system cookies and shared state with Safari. The older version (using an ancient xcode on 10.4) worked fine.

If I launch the app and login using PandoraMan, it logs in, and the site works as normal. However when I restart the app I always have to login again. This never used to happen, and I can't find anything in the docs regarding this issue.

If anyone has some insight on this issue it would be fantastic. The code is open source, so you can check out the issue without bouncing code back and forth in the comments.

like image 567
quest Avatar asked Nov 05 '22 10:11

quest


1 Answers

Your application has its own "cookie jar" in the [NSHTTPCookieStorage sharedHTTPCookieStorage] container.

Here's how you might take a quick look at the cookies in your application's cookie jar:

NSHTTPCookie *cookie;
NSHTTPCookieStorage *cookieJar = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [cookieJar cookies]) {
    NSLog(@"%@", cookie);
}

Several methods are available for filtering and manipulation. Take a look at the NSHTTPCookieStorage documentation for accessing cookies, and the NSHTTPCookie documentation for accessing individual cookie properties

May be this can help your problem.

like image 137
Ajeet Pratap Maurya Avatar answered Nov 15 '22 05:11

Ajeet Pratap Maurya