nshttpcookie

Does WKWebView uses cookies from Safari?

坚强是说给别人听的谎言 提交于 2021-01-24 06:59:12
问题 According to Apple documentation: ... cookies are shared among all applications and are kept in sync across process boundaries. But there is this iOS Note : Cookies are not shared among applications in iOS. So basically I can not use cookies from Safari inside my app? 回答1: iOS security sandbox disables cookie sharing amongst apps using WKWebView as you've discovered with the iOS note and there's no way around this. You can share cookies between multiple WKWebView 's inside your app by

Set Cookie for UIWebView requests

寵の児 提交于 2020-01-21 05:03:04
问题 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 with the properties for the Cookie and then create a new NSHttpCookie and add it to the NSHttpCookieStorage.SharedStorage . Sadly the cookie seems to be empty and not used for the request. An example of how to build be cookie with properties and a

NSHTTPCookies refuse to be deleted

痞子三分冷 提交于 2019-12-29 05:27:07
问题 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]) { [[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie]; } } (the while is just there to make sure they get deleted, it only runs once however) If I NSLog the description of shared cookie storage after the above code it outputs that the array is empty.

Share WKWebView Cookies With UIWebView

怎甘沉沦 提交于 2019-12-25 12:47:08
问题 I'm trying to share WKWebView Cookies with UIWebView for getting all cookies. I know its very simple to get all cookies from UIWebView as compare WKWebView. I create two WebView's (WKWebView, UIWebView) in Tabbed Application Template. Below method that i am using for share WKWebView cookies with UIWebView but didn't get success. func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) { let

Share WKWebView Cookies With UIWebView

烂漫一生 提交于 2019-12-25 12:47:05
问题 I'm trying to share WKWebView Cookies with UIWebView for getting all cookies. I know its very simple to get all cookies from UIWebView as compare WKWebView. I create two WebView's (WKWebView, UIWebView) in Tabbed Application Template. Below method that i am using for share WKWebView cookies with UIWebView but didn't get success. func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) { let

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

余生颓废 提交于 2019-12-23 10:04:44
问题 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 for getting cookies: - (void)getCookies { NSHTTPURLResponse * response; NSError * error; NSMutableURLRequest *request; request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://MyWebsite.com/login.php"] cachePolicy

Clear iPhone simulator cookies

柔情痞子 提交于 2019-12-20 15:37:06
问题 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 wait until the cookie is invalid, which could take some time. To accelerate this I figured that if I delete the cookie it would have the same effect. How to delete all cookies of an app on the iPhone simulator? I already tried the following:

NSHTTPCookieStorage Array - Parsing out the Value

旧城冷巷雨未停 提交于 2019-12-11 13:59:20
问题 I have data inside an array (NSHTTPCookieStorage)... NSARRAY *httpCookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:aHttpUrl]; I know for a fact that there are 3 cookies being stored (as I can see them in an NSLog). I don't know how to obtain 1 specific cookies value based on the "name". Example: <NSHTTPCookie version:0 name:\"username\" value:\"namehere\" expiresDate:2035-08-3 23:12:50 +0000 created:2015-08-08 23:12:49 +0000 (4.60768e+08) sessionOnly:FALSE domain:\

Set NSHTTPCookieExpires manually

混江龙づ霸主 提交于 2019-12-10 17:39:56
问题 I want to set a NSHTTPCookie in the NSHTTPCookieStorage . For doing that, I am creating a cookie & adding it to the NSHTTPCookieStorage as shown below:- NSDictionary *propertiesDevice = [NSDictionary dictionaryWithObjectsAndKeys: @"http://www.sample.com/", NSHTTPCookieDomain, @"/", NSHTTPCookiePath, @"someCookieName", NSHTTPCookieName, @"myCookieValue", NSHTTPCookieValue, timeStamp,NSHTTPCookieExpires,nil]; NSHTTPCookie *cookieDevice = [NSHTTPCookie cookieWithProperties:propertiesDevice]; [

Creating a non-tracking in-app web browser

只谈情不闲聊 提交于 2019-12-09 06:00:06
问题 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 sharedSession]resetWithCompletionHandler:^{}]; but I am finding that things like google search history persists some how between sessions. I have also tried clearing cookies separately through NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; for (NSHTTPCookie *cookie in