【问题标题】:Pass cookies to WKWebView / SFSafariViewController?将 cookie 传递给 WKWebView / SFSafariViewController?
【发布时间】:2018-10-30 20:42:17
【问题描述】:

我使用 Alamofire 进行服务器访问,而服务器 API 使用 cookie 进行身份验证。现在我想打开一个 web 视图并将应用程序中的 auth cookie 包含在 web 视图中。

Web 视图中的 API 和 URL 使用相同的域。 我真的不在乎它是使用 WKWebView 还是 SFSafariViewController,但我更喜欢 SFSafariViewController。

这可能吗?

【问题讨论】:

  • wkwebview 从 Httpcookiestorage 更改为 httpcookiestore 后,您必须同步您的 cookie。 wkwebview 有自己的 cookie 存储

标签: swift cookies webview alamofire sfsafariviewcontroller


【解决方案1】:

您只能使用 WKWebView 手动设置 cookie。请先阅读本文https://forums.developer.apple.com/thread/97194

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-14
    • 1970-01-01
    • 2016-03-01
    • 2016-04-12
    • 1970-01-01
    • 1970-01-01
    • 2018-11-08
    • 1970-01-01
    相关资源
    最近更新 更多