WKWebView Cookies

旧街凉风 提交于 2019-12-04 20:22:23

Multiple Cookies are sent if there are more than one cookie in the cookie store whose domains (or paths) match the requested URL.

Whilst writing your getCookieString method you may have changed or added the domain= part of the string. This would cause a second valid cookie to be stored and therefor sent with your request.

Removing domain= from my getCookieString method fixed the issue

-(NSString *)getCookieString 
 {
   NSString *string = [NSString stringWithFormat:@"%@=%@;expiresDate=%@;path=%@;sessionOnly=%@;isSecure=%@",
            self.name,
            self.value,
            self.expiresDate,
            self.path ?: @"/",
            self.isSecure ? @"TRUE":@"FALSE",
            self.sessionOnly ? @"TRUE":@"FALSE"];
   return string;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!