SfSafariViewController 和共享 cookie 存储

SfSafariViewController and shared cookie storage

SFSafariViewController(SVC) 是在 iOS 9 中引入的,SVC 可以从 Mobile safari 而不是从应用程序读取 cookie,它可以写入 cookie,并且它可以被 Mobile Safari 而不是移动应用程序访问。

上述行为在 iOS 10 之前是相同的。

从iOS开始 11 SVC 无法读取 Mobile Safari 的 cookie。

那么截至 iOS 11 日,Cookie 共享中的东西在哪里?

SVC 在哪里存储来自 iOS 11 的 cookie?

SVC 是否将 cookie 存储在启动应用本身中?

如果是,app中的webview(UIWebview/Wkwebview)能否读取SVC写的cookies

如果是,SVC可以读取Webview写的cookie吗

如果否,SVC 能否读取它在上次会话期间写入的 cookies

或者 SVC 更像是 Safari 的 incongnito 版本,它不记得以前的会话,它不能访问应用程序和移动 Safari 的 webview 的 cookie。

Where SVC stores it's cookies from iOS 11 ?

cookies/other 数据当前保存在 SystemData/com.apple.SafariViewService/Library 中的容器下,然后保存在 CookiesWebkit/WebsiteData 下 - 这可能会在未来版本中更改!

Does SVC store the cookie inside the launching app itself ?

是的,在您的容器中

If yes , can webview(UIWebview/Wkwebview) in app read the cookies written by SVC

不是开箱即用的,您可以使用自定义 URLRequest 加载 Web 视图,然后让它读取这些文件,我不推荐它,因为当前保存的格式没有记录并且可能会更改未来。

If no , can SVC read the cookies that it wrote during the last session

是的,SFSafariViewController 维护它来自以前会话的数据,它对您的应用程序是私有的,因为它存储在您的容器中。