我正在尝试使用 SwiftUI 在 SecureField 中使用强密码建议功能,但它不起作用。只是想知道我是做错了什么还是这是一个错误。
@State var password: String = ""
@State var confirmPassword: String = ""
var body: some View {
VStack {
SecureField("Password", text: $password) {
// do something
}
.textContentType(.newPassword)
SecureField("Confirm Password", text: $confirmPassword) {
// do something
}
.textContentType(.newPassword)
}
}
当我选择 secureField 时,它不建议使用强密码。编辑:
经过进一步的测试和下面的评论后,我添加了一个关联的域并将以下 Web 凭据文件上传到我的网络服务器 example.com/.well-known/apple-app-site-association.txt:
{
"webcredentials": {
"apps": [ " TEAMID.com.example.AppName" ]
}
}
我目前的功能是关联域和自动填充凭据提供程序设置为 YES。当我尝试使用强密码时,我收到以下错误消息:
Cannot show Automatic Strong Passwords for app bundleID: com.example.AppName due to error: Cannot identify the calling app's process. Check teamID and bundleID in your app's application-identifier entitlement
不知道从这里去哪里。
最佳答案
如果您想建议新密码,则需要使用 .newPassword
文本内容类型。.password
用于输入现有密码。
关于ios - .newPassword for SecureField 选择强密码在使用 SwiftUI 和 iOS14 时不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66620520/