【发布时间】:2020-09-12 10:15:28
【问题描述】:
我有一个遵循password auto-fill requirements 的示例HTML 表单。在没有应用程序的情况下导航到网页时,使用内置的 Safari 应用程序,登录和注册表单的本机密码自动填充对话框正确显示:
但是,在应用程序中查看时,相同的流程不会在登录或注册提交中触发对话框。它只是关闭登录/注册屏幕而没有任何错误。
这就是我的视图控制器的样子:
class ViewController: UIViewController {
@IBAction func didTapLoginButton() {
let session = ASWebAuthenticationSession(
url: URL(string: "https://example.com/login.html")!,
callbackURLScheme: "customscheme") {
print($0, $1)
}
session.prefersEphemeralWebBrowserSession = true
session.presentationContextProvider = self
session.start()
}
}
extension ViewController: ASWebAuthenticationPresentationContextProviding {
func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
view.window!
}
}
有没有办法让密码自动填充功能通过ASWebAuthenticationSession 与移动应用程序一起使用?我也试过SFSafariViewController 但同样的问题。我有一个sample iOS app here。非常感谢任何帮助或经验!
【问题讨论】:
标签: ios swift autofill aswebauthenticationsession