Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Private cookie for only my app? Why is it influencing the browser's cookie?

When I log into my app, my browser's cookie for the same site is lost. Why is this cookie being shared between apps? Logging-in in Chrome does not affect Safari's cookies, how can I emulate that behavior in my App Store app?

I am logging into a website's API and setting a cookie via: [NSHTTPCookieStorage setCookie]

Using the docs, I see two ways to get the cookie storage location:

– initWithStorageLocation: (Deprecated, Available in Mac OS X v10.6 through Mac OS X v10.6)

and

+ sharedHTTPCookieStorage

It seems like the first one is similar to what I want, using a unique storage loaction that is only usable by my app. But that method is deprecated in Lion? How then do you use a private my-app-only cookie?

like image 315
ck_ Avatar asked Oct 27 '11 21:10

ck_


1 Answers

By not using the cookie-management of the OS but implementing your own. IIRC Chrome on OSX uses an SQLite3 DB to store cookies and implements several parts of the browser/http/network communication itself.

like image 50
Yahia Avatar answered Oct 02 '22 23:10

Yahia