[英].newPassword for SecureField to choose Strong Password not working using SwiftUI and iOS14
我正在嘗試使用 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)
}
}
當我 select 使用secureField時,它不建議使用強密碼。
編輯:
在下面的進一步測試和評論之后,我添加了一個關聯的域並將以下 web 憑據文件上傳到我的網絡服務器 example.com/.well-known/apple-app-site-association.txt:
{
"webcredentials": {
"apps": [ " TEAMID.com.example.AppName" ]
}
}
我目前的功能是將關聯域和自動填充憑據提供程序設置為是。
當我嘗試使用強密碼時,我收到以下錯誤消息:
無法顯示應用程序 bundleID 的自動強密碼:com.example.AppName 由於錯誤:無法識別調用應用程序的進程。 檢查您應用的應用程序標識符權利中的 teamID 和 bundleID
不確定從這里到 go 的位置。
如果您想建議新密碼,則需要使用.newPassword
文本內容類型。
.password
用於輸入現有密碼。
如果您使用.newPassword
和“關聯域”適當地設置了 SecureFields,登錄時自動填充和強密碼的建議應該可以在您的設備上使用。
但請務必登錄 iCloud 帳戶並啟用 iCloud 鑰匙串。 如果不是這種情況,它不會建議使用強密碼,因為它無法跨設備同步它們。 它將 output 一些日志如下:
[AutoFill] Cannot show Automatic Strong Passwords for app bundleID:
com.example.signin-playground due to error: iCloud Keychain is disabled
此測試只能在真實設備上進行,因為您無法在模擬器中啟用 iCloud 鑰匙串。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.