与 Safari 同步 - SFSafariViewController 的扩展
Sync with Safari - extension for SFSafariViewController
我知道 SFSafariViewController
有私有 cookie 存储和其他实现。但是,我知道我们可能会为每个(每个本机系统)Swift class 编写一个扩展。
我需要与本机 Safari 共享 cookie,或者通过一些 header 请求从我的应用程序打开 Safari
。至少,如何为 getting/setting 个 cookie 创建一个 API
?
- SFSafariVC 和本机 Safari 之间的 Cookie 共享已在 iOS >= 11 中被禁用。
At WWDC, Apple announced a change in the behavior of Safari View Controller with iOS 11 in that stored data (cookies, local storage, etc.) will no longer be shared between instances of Safari View Controller. We've confirmed this in-house with a beta version, and this seems to be independently confirmed by the folks at Branch.
From AppAuth-iOS' repo: user whitehatguy
- SFSafariVC 的唯一 API 是为给定的 URL 创建一个新实例。您不能设置或修改 cookie。
如果您需要执行自定义代码,请查看 WKWebView (iOS >= 8) / UIWebView (iOS < 8). Useful answers:
SFAuthenticationSession 的创建是为了允许 SSO/OAuth 身份验证流程,它与本机 Safari 共享 cookie,但开发人员无法直接访问。
A class that manages sharing a one-time web service login, along with cookies and website data, between Safari and an app, which can also be used for automatic login for other associated apps.
The two cases where you would use SFAuthenticationSession are:
- Logging in to a third party's service using an authentication protocol (e.g. OAuth). This option works well for social network applications.
- Providing a single sign-on (SSO) experience for applications. This option works well for enterprise companies that have many applications installed on the same device.
SFAuthenticationSession's documentation by Apple
我知道 SFSafariViewController
有私有 cookie 存储和其他实现。但是,我知道我们可能会为每个(每个本机系统)Swift class 编写一个扩展。
我需要与本机 Safari 共享 cookie,或者通过一些 header 请求从我的应用程序打开 Safari
。至少,如何为 getting/setting 个 cookie 创建一个 API
?
- SFSafariVC 和本机 Safari 之间的 Cookie 共享已在 iOS >= 11 中被禁用。
At WWDC, Apple announced a change in the behavior of Safari View Controller with iOS 11 in that stored data (cookies, local storage, etc.) will no longer be shared between instances of Safari View Controller. We've confirmed this in-house with a beta version, and this seems to be independently confirmed by the folks at Branch.
From AppAuth-iOS' repo: user whitehatguy
- SFSafariVC 的唯一 API 是为给定的 URL 创建一个新实例。您不能设置或修改 cookie。
如果您需要执行自定义代码,请查看 WKWebView (iOS >= 8) / UIWebView (iOS < 8). Useful answers:
SFAuthenticationSession 的创建是为了允许 SSO/OAuth 身份验证流程,它与本机 Safari 共享 cookie,但开发人员无法直接访问。
A class that manages sharing a one-time web service login, along with cookies and website data, between Safari and an app, which can also be used for automatic login for other associated apps.
The two cases where you would use SFAuthenticationSession are:
- Logging in to a third party's service using an authentication protocol (e.g. OAuth). This option works well for social network applications.
- Providing a single sign-on (SSO) experience for applications. This option works well for enterprise companies that have many applications installed on the same device.
SFAuthenticationSession's documentation by Apple