try 从URLCredentialStorage
检索未知URLProtectionSpace
的URLCredential
时发生此错误.
例如:
let protectionSpace = URLProtectionSpace.init(host: host,
port: port,
protocol: "http",
realm: nil,
authenticationMethod: nil)
var credential: URLCredential? = URLCredentialStorage.shared.defaultCredential(for: protectionSpace)
生产
CredStore - performQuery - Error copying matching creds. Error=-25300, query={
class = inet;
"m_Limit" = "m_LimitAll";
ptcl = http;
"r_Attributes" = 1;
srvr = host;
sync = syna;
}
为其提供保护空间的凭据:
let userCredential = URLCredential(user: user,
password: password,
persistence: .permanent)
URLCredentialStorage.shared.setDefaultCredential(userCredential, for: protectionSpace)
下次您try 检索凭据时,该错误将消失.
我有点不知所措,因为我不确定是什么原因造成的,或者是什么原因
iOS上的凭据存储允许用户将设备上基于证书或基于密码的凭据安全地临时或永久存储到密钥链.
我怀疑您的后端服务器上有某种身份验证,并且该服务器正在请求对您的应用进行身份验证质询(不存在任何凭据).
可以安全地忽略它,因为从URLCredentialStorage
返回nil是有效的响应