Questions tagged [nshttpcookie]

An NSHTTPCookie object represents an HTTP cookie. It’s an immutable object initialized from a dictionary containing the cookie attributes.

Two versions of cookies are supported:

  • Version 0: This version refers to “traditional” or “old-style” cookies, the original cookie format defined by Netscape. The majority of cookies encountered are in this format.
  • Version 1: This version refers to cookies as defined in RFC 2965, HTTP State Management Mechanism.
72 questions
56
votes
3 answers

NSHTTPCookieStorage state not saved on app exit. Any definitive knowledge/documentation out there?

Struggling with this problem and loath to implement a custom cookie management system. It appears some hidden level of iOS's implementation of HTTP fails to manage sessionless cookies properly. Any time an HTTP response sets or deletes a cookie,…
kball
  • 4,765
  • 3
  • 26
  • 31
15
votes
4 answers

Shared instance of NSHTTPCookieStorage does not persist cookies

I'm developing an application where the server hands me a cookie to identify the user. My successive requests need to have that cookie to have the response that the user expects. What I can't understand is how and when the shared instance of…
Moxy
  • 4,120
  • 2
  • 28
  • 49
11
votes
2 answers

Problem with NSRange

I'm having a problem with NSRange. Here is my code: NSRange range = [[[NSHTTPCookie requestHeaderFieldsWithCookies:[[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[NSURL URLWithString:cookie]]] objectForKey:@"Cookie"]…
Rudiger
  • 6,515
  • 13
  • 48
  • 94
10
votes
1 answer

AVPlayer fails to send a cookie for the same domain after 302 redirect

I am using iOS AVPlayer to play a HLS stream. In the beginning of the HLS session, when I receive index.m3u8 URL in response to create AVPlayerItem, the response also sets a cookie which is required for session based auth. Say this cookie name is…
indiantroy
  • 1,473
  • 1
  • 14
  • 25
9
votes
1 answer

how to support incognito/private mode in wkwebview/uiwebview

I am working on a incongnito browser.I am using wkwebview when I clear all the cookies I can see that popular search engine like google remembers the searches that has been made. I tried cleaning all the cookies in NSHTTPCookieStorage and…
Shiva
  • 465
  • 1
  • 7
  • 38
9
votes
1 answer

Separate cookie storage for two (UIWebView or WKWebView)

I want to login many accounts of same site in different webView. For example i have Tab Bar Controller that contains three view controllers and each view controllers contain webView. And for example i embed stackoverflow url for webView in every…
ZAFAR007
  • 2,545
  • 1
  • 26
  • 40
9
votes
1 answer

AFNetworking Persisting Cookies Automatically

In: This Question it is said AFNetworking takes care of cookies automatically in the background, but in a Previous question I asked, I was having trouble keeping the session on the server that was made in php when I logged in. Once I closed(stop…
TMan
  • 3,916
  • 17
  • 57
  • 113
7
votes
2 answers

NSHTTPCookieStorage and Cookie Expiration Date

In our iPhone app we use two cookies during server communication. One is a short session cookie (JSESSION), and the other is a long session cookie (REMEMBER ME). If an answer comes from the server, it sends a short session cookie, which I can find…
madik
  • 123
  • 2
  • 10
7
votes
3 answers

NSHTTPCookies refuse to be deleted

I need a log out button for my app, I have the below code: while ([[[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies] count] != 0) { for (NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) { …
Jonathan.
  • 51,850
  • 46
  • 174
  • 275
7
votes
0 answers

WKHTTPCookieStore not retrieving set Cookie.

I'm trying to set a cookie programmatically but it's not working. The cookie gives the impression that it's valid. I then set it on the WKWebsiteDataStore.default().httpCookieStore. In the asynchronous call back I then try to get all the cookies out…
Mark Bridges
  • 7,606
  • 4
  • 43
  • 59
7
votes
1 answer

WKWebView, get all cookies

I want obtain all cookies from WKWebView. Why? I have been started a project that use web-based auth. As result, I should intercept cookies to be sure that user is logged in and for some other purposes. Another case - imagine if user logged in, and…
hbk
  • 9,872
  • 9
  • 82
  • 110
7
votes
2 answers

Creating a non-tracking in-app web browser

I am trying to create a webview (as an exercise) that does not track or store any browsing history locally. I have made it so that when the webview is closed, it calls the following [[NSURLSession…
mylogon
  • 2,283
  • 2
  • 24
  • 39
6
votes
6 answers

Clear iPhone simulator cookies

I have an app that makes request to a REST service. Authentication is done using cookies. This already works. What I have problems with is to test the case when the cookie is no longer valid and my code has to reauthenticate. To test this I have to…
sliver
  • 1,640
  • 2
  • 14
  • 22
6
votes
1 answer

How to get cookies and use them for other requests like POST ( iOS )?

My previous question was about the problem that I have to login each time for doing web services like posting a link or uploading a picture. Philipe answered that I have to use cookies instead of login process for each request. I found this method…
Hamid
  • 2,272
  • 1
  • 25
  • 41
5
votes
5 answers

Set Cookie for UIWebView requests

I want to embed an UIWebView into my MonoTouch application for an area that is not yet implemented natively. In order to authenticate with the website I want to set a cookie containing a key for the current session. I tried creating a NSDictionary…
Timm
  • 2,562
  • 2
  • 22
  • 34
1
2 3 4 5