开发者

Semantic question regarding NSURLRequest and HTTP Cookies

I've been thumbing through the Apple documentation and I can't seem to find out if cookies are saved/used for every instance of NSURLConnection, or just a single instance. It seems as though the cookies are hanging around even after I release my in开发者_Go百科dividual instances of NSURLConnection, but I am unsure if my tests are comprehensive. Any help on this would be greatly appreciated.

Thanks in advance!


It depends on which operating system you are developing. On Mac OS X, cookies are shared by all processes for a given user. On iOS, they are not. In both cases, cookies accepted by a given application are shared within the application process and across instances of the application.

Again, from the documentation of NSHTTPCookieStorage:

NSHTTPCookieStorage implements a singleton object (shared instance) that manages the shared cookie storage. These cookies are shared among all applications and are kept in sync cross-process.

(bold emphasis mine)

Further,

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

(bold emphasis theirs)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜