【发布时间】:2018-11-19 04:34:27
【问题描述】:
【问题讨论】:
-
伙计,这太新了,不能说。我的想法是,手机现在有了智能,可以自动将应用名称和消息中的代码关联起来。
-
@lee 即使我的 iPhone 键盘上没有收到该建议
-
将您的文本字段设置为
.oneTimeCode,并且您的短信内容也需要包含OTP字符串。
【问题讨论】:
.oneTimeCode,并且您的短信内容也需要包含OTP 字符串。
评论WWDC 2018 Session 204 - Automatic Strong Passwords and Security Code AutoFill。
您需要使用UITextField 进行输入和系统键盘(无自定义控件)并将其上的textContentType 设置为.oneTimeCode(iOS 12 中的新功能)。
let securityCodeTextField = UITextField()
securityCodeTextField.textContentType = .oneTimeCode
操作系统将自动检测带有此UITextContentType 设置的消息中的验证码(包含单词“code”或“passcode”的消息)。
【讨论】:
对于那些在 HTML 中搜索如何做到这一点的人:需要为您的输入字段添加 autocomplete="one-time-code"。
<input id="single-factor-code-text-field" autocomplete="one-time-code"/>
(来自Apple Docs)
【讨论】:
autocomplete"off"。
iOS 支持 UITextField、UITextView 和任何采用 UITextInput 协议的自定义视图上的密码自动填充。系统键盘将其上的 textContentType 设置为 .oneTimeCode
singleFactorCodeTextField.textContentType = .oneTimeCode
重要
tvOS 应用程序也可以使用相同的方式支持密码自动填充 内容类型设置。 AutoFill QuickType 栏出现在 使用 Control 在 iOS 设备上输入密码时的键盘 中心键盘、远程应用程序或连续互通键盘。重点是 当登录字段被填充时,也会前进到登录按钮。
警告
如果您对安全代码输入文本字段使用自定义输入视图, iOS 无法显示必要的自动填充 UI。
【讨论】: