如果在KeyChain中发现重复项,我想更新密钥的值。这是我的代码:
let localAuthContext = LAContext.init()
localAuthContext.setCredential(password.data(using: String.Encoding.utf8)!, type: LACredentialType.applicationPassword)
var query: [String: Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecAttrAccount as String: key,
kSecAttrAccessControl as String: access,
kSecUseAuthenticationContext as String: localAuthContext,
kSecValueData as String: value.data(using: String.Encoding.utf8)!]
var newAttributes: [String: Any] = [kSecValueData as String: value.data(using: String.Encoding.utf8)!]
SecItemUpdate(query as CFDictionary, newAttributes as CFDictionary)
我收到-25293错误-errSecAuthFailed。
有输入吗?