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

标签 ios swift

我有一个 passwordField,我将 isSecureTextEntry 设置为 true 以隐藏字符。但是当我点击这个passwordField时,日志中出现如下错误:

[AutoFill] Cannot show Automatic Strong Passwords for app bundleID: "myapp" due to error: iCloud Keychain is disabled

键盘自动从 azerty 变为 qwerty...

如果我删除 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

我测试了this answer但没有任何改变。

如何在没有 iCloud Keychain 且不将键盘更改为 qwerty 的情况下隐藏我的 textField 的字符?

我检查了其他答案,但没有什么与我的问题相似...

最佳答案

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

我在模拟器上遇到了这个,然后来到这里。在我的手机上试了一下(启用了 iCloud 钥匙串(keychain) ),结果得到了这个:

[AutoFill] Cannot show Automatic Strong Passwords for app bundleID: your.bundle.id due to error: Cannot save passwords for this app. Make sure you have set up Associated Domains for your app and AutoFill Passwords is enabled in Settings

这就是 Apple 很酷的自动填充功能。描述了一些步骤 here那应该可以做到这一点。

关于ios - 将 PasswordField 设置为 secureTextEntry 给我一个奇怪的行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52770550/

相关文章:

swift - 为什么 CLGeoCoder 无法获取任何内容?

ios - CGContextSaveGState : invalid context 0x0 at App Launch

swift - 将列添加到 Vapor 中的现有表

android - travis-ci 可以使用多种语言和多种操作系统吗?

iOS CorePlot 点转换

ios - 如何处理具有相同标识符的动态插入的 UITableView 单元格?

ios - 自动布局 : can't get the frame size of UICollectionViewCell subViews

swift - 具有可变输入参数列表的协议(protocol)中的函数声明

ios - SLComposeViewController: "No Twitter Accounts"警报的不同行为取决于是否安装 Twitter 应用程序

ios - 每次我注销并再次登录时,我的表格 View 单元格都会重复