美文网首页
iOS - Password AutoFill

iOS - Password AutoFill

作者: ienos | 来源:发表于2020-11-20 18:32 被阅读0次

密码自动填充


Version - - iOS 11.0

  • 简化登陆流程
  • 保存密码,用户不用记住密码

一、实现原理

  • 将用户的登陆凭证保存在 iOS 设备上
  • iOS 通过 iCould 钥匙串在用户设备上同步这些凭证到相关的域名(与应用程序绑定)
  • App 推荐相关域名对应的凭证,在访问凭证之前,用户必须使用 Face ID 和 Touch ID 进行验证

二、实现步骤

  • Supporting Associated Domains

  • 设置 textfield 的 contentType (iOS 11 新增了 .username 和 .password)

    1. userTextField.textContentType = .username
    2. passwordTextField.textContentType = .password
    3. 当 username tf 和 password tf 处于不同屏幕或者视图时,依旧可以使用该特性
    4. contentType 和 keyboardType 可联合使用 : UITextContentType.password 和 UIKeyboardType.emailAddress

• Make the QuickType bar appear, 确保有 password 保存在凭证中才会显示 🔑

image.png

在 Setting -> Accounts & Passwords 中可查看已保存的密码,记得打开自动填充密码开关

image.png

三、Support Third-Party Web Services

在 Safari view controller 中添加 Password AutoFill,使用 ASWebAuthenticationSession

相关文章

网友评论

      本文标题:iOS - Password AutoFill

      本文链接:https://www.haomeiwen.com/subject/dckjiktx.html