1
votes

According to Apple documentation on NSHTTPCookieStorage

The NSHTTPCookieStorage class provides the interface for managing the collection of NSHTTPCookie objects shared by all applications.

Therefore, If I'm not mistaken, since a Webview on OS X uses NSHTTPCookieStorage, and Safari uses Webviews, if I login on a given website on a Webview, Safari will use the cookies that has been set by the Webview and when the same website is opened by Safari, it should be authenticated.

My question is, if cookies are shared between Safari and Webviews. If so, why the test above is not working ?

3

3 Answers

6
votes

According to the NSHTTPCookieStorage documentation:

Starting in OS X 10.11, each app has its own sharedHTTPCookieStorage singleton, which will not be shared with other applications.

So while the previous answer was correct 3 years ago when it was written, the answer now should be:

1) before OS X 10.11 - Yes they were shared

2) OS X 10.11 and macOS 10.12 - No they are no longer shared.

5
votes

Per discussion at Understanding NSHTTPCookieStorage for the iPhone, cookies are not shared between applications.

This is confirmed in the documentation under the "Cookie Storage" section:

iOS Note: Cookies are not shared by applications in iOS.

1
votes

In my experience, on OS X, the answer is a resounding yes. Cookies do appear to be shared between Safari and WebViews.