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
3
votes
1 answer

Cookies not sent with NSMutableURLRequest

Firstly, the app would open a UIWebView to a login page on my website, upon successful log in, the webview will be closed. There's a url I need to request which would return a very small json data. If I were to launch this url with a webview, the…
2
votes
1 answer

Problem with NSHTTPCookie

I want to make login application. My first screen login form with two text fields and one button. When I pres this button I invoke one method that invoke this method: - (int)login { // Add data to post request NSHTTPURLResponse * response; NSString…
nyanev
  • 10,527
  • 6
  • 42
  • 76
2
votes
0 answers

WKWebView's WKUrlSchemeHandler and Cookies with the Secure property

Since iOS 11, you could use WKURLSchemeHandler with WKWebView: A protocol for loading resources with URL schemes that WebKit doesn't know how to handle. If you used a custom-scheme - let's say foobarhttps - WKWebView does NOT appear to treat it…
rustyMagnet
  • 2,348
  • 19
  • 31
2
votes
0 answers

Don't get all cookies from NSHTTPURLResponse or NSHTTPCookieStorage

I'm trying to programmatically submit a form using a NSURLConnection. To make sure I get the proper response when sending the form, I collect the form using an NSURLConnection, collect all the cookies from the corresponding NSHTTPURLResponse,…
2
votes
2 answers

WKHTTPCookieStorage's setCookie doesn't return after closing and opening web view

I have the code below to copy cookies from the general HTTPCookieStorage, into my webview's cookie store. After all cookies are copied, I load the webview let webView = WKWebView(frame: containerView.bounds, configuration:…
Binya Koatz
  • 139
  • 1
  • 6
2
votes
2 answers

Swift 3: how to check if cookies for particular URL are configured?

I'm building an app for an API with cookie-based validation, and am having several issues with it. My current problem is a function to check if autologin cookie is configured for the domain, but I can't get my head around setting it up properly. My…
michalronin
  • 243
  • 2
  • 12
2
votes
0 answers

NSHTTPCookieStorage - lost cookies in app termination (SIGKILL) iOS 8

In my app registration i am getting & setting cookies from the server for user authentication, this are the header fields I'm getting from the server: [Content-Type: application/json, Pragma: no-cache, X-Powered-By: …
MisterGreen
  • 156
  • 8
2
votes
1 answer

NSHTTPCookieStorage shared across multiple apps

How do I share a NSHTTPCookieStorage across multiple iOS apps? I want MYAPP A and MYAPP B to use the same cookies, so I can switch between them easily. I found the following method in NSHTTPCookieStorage.h but did not see it mentioned in the…
72A12F4E
  • 1,684
  • 1
  • 12
  • 28
2
votes
0 answers

NSHTTPCookieStorage UTF-8 cookie name value is truncated

In an iOS 7 app I'm using NSHTTPCookieStorage to store cookies in the sharedHTTPCookieStorage. One of the cookies I'm receiving has a name value with the non-ASCII word "Søren" in it. I can see the cookie being set in an HTTP trace, but the cookie…
retrodev
  • 2,143
  • 5
  • 22
  • 43
2
votes
0 answers

Delete simulator Safari cookies and caches

I need to delete simulator cookies whenever needed. I need to delete the Facebook cookie from the iOS simulator. I tried the following code, and it does not works. - (IBAction)Logout:(id)sender { NSHTTPCookieStorage *cookieStorage =…
R M
  • 1,201
  • 2
  • 8
  • 6
2
votes
1 answer

How to force UIWebView to read NSHTTPCookie

I have a UIWebView that shows a login page. The user fill user and password and after the login the page save a NSHTTPCookie in the app sandbox. With this line of code [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies] I can read all my cookies…
Fry
  • 6,036
  • 8
  • 48
  • 89
1
vote
1 answer

Missing some cookies on NSURLRequest after changing to WKWebView

I am in the process of replacing UIWebView in our app with WKWebView and I have run into a cookie problem. There is a login process in our app where a webform is shown in a web view, and if the login was successful we call a service that gives us…
pajevic
  • 4,300
  • 4
  • 31
  • 63
1
vote
0 answers

How to observe webview to get cookies of a specific page in iOS swift?

I have a Webview of WKWebview where I am loading a URL. The loaded website have a login page and a home page. After login, user is directed to the home page. While logging in, a cookie is sent to the user. I want to get this cookie and at that very…
Razon
  • 11
  • 3
1
vote
0 answers

HTTPCookieStorage's setCookies method says URL is optional but fails if you pass in nil

Hey so I'm trying to use the setCookies method in HTTPCookieStorage, and I see that the URL parameter is "optional", but when I pass in nil, it calls CFURLCopyHostName, which implicitly unwraps the URL and the call breaks. I'm okay adding a URL, but…
1
vote
0 answers

Duplicate Set-Cookie Headers from HTTPURLResponse

I am hitting an API to get a cookie for authenticating subsequent requests. I need to get the cookie from this collection of response headers: { "Server": "Cowboy", "Connection": "close", "Set-Cookie":…
Nick Kohrn
  • 4,845
  • 3
  • 21
  • 41