将PasswordField设置为secureTextEntry给我一个奇怪的行为

El-*_*tos 14 ios swift

我有一个passwordField,我将其设置isSecureTextEntry为true,用于隐藏字符.但是,当我点击这个时,passwordField这告诉我这个错误:

[AutoFill] Cannot show Automatic Strong Passwords for app bundleID: "myapp" due to error: iCloud Keychain is disabled
Run Code Online (Sandbox Code Playgroud)

键盘自动传递到一个qwerty的azerty ...

如果我删除passwordField.isSecureTextEntry = true问题消失但角色没有隐藏...

我告诉你我的代码:

passwordField.borderStyle = UITextField.BorderStyle.none
passwordField.font = UIFont(name: "Avenir-Heavy", size: 13)
passwordField.autocorrectionType = UITextAutocorrectionType.no
passwordField.clearButtonMode = UITextField.ViewMode.whileEditing
passwordField.keyboardType = UIKeyboardType.default
passwordField.returnKeyType = UIReturnKeyType.done
passwordField.contentVerticalAlignment = UIControl.ContentVerticalAlignment.bottom
passwordField.isSecureTextEntry = true
Run Code Online (Sandbox Code Playgroud)

我测试了这个答案,但没有任何变化

如何在没有iCloud Keychain和没有更改键盘的情况下隐藏我的textField的字符到qwerty?

我看了所有其他主题,但没有比我的问题...

Moj*_*aba 11

在我们的例子中,我们在同一屏幕上有另一个文本字段,内容类型为Email Address,将其更改为Username神奇地解决了问题。

  • 我认为这是因为“UITextContentType.username”和“UITextContentType.newPassword”是自动填充启发式的一部分。如果您的应用程序使用电子邮件作为用户名,那么 Apple 建议将文本字段的“textContentType”设置为“.username”,将“keyboardType”属性设置为“.emailAddress”。请参阅:https://developer.apple.com/documentation/security/password_autofill/enabling_password_autofill_on_a_text_input_view (2认同)

Dar*_*ack 11

当系统用户没有启用 iCloud 钥匙串时,就会发生这种情况。模拟器上经常会出现这种情况:)

我在模拟器上遇到了这个并来到了这里。试了一下我的手机(如iCloud的钥匙扣上启用),并得到了这个:

[自动填充] 无法为应用程序 bundleID 显示自动强密码:your.bundle.id 由于错误:无法保存此应用程序的密码。确保你已经为你的应用设置了关联域,并且在设置中启用了自动填充密码

所以这是苹果很酷的自动填充功能。有描述的一些步骤在这里应该启用。

  • iCloud 钥匙串已启用,但我仍然收到此错误 (2认同)

归档时间:

查看次数:

5285 次

最近记录:

6 年,4 月 前