manager.delegate.sessionDidReceiveChallenge = {
session,challengein
return (URLSession.AuthChallengeDisposition.useCredential,URLCredential(trust:challenge.protectionSpace.serverTrust!))
}
都信任
或者
letserverTrustPolicies: [String:ServerTrustPolicy] = [
"test.example.com": .pinCertificates(
certificates:ServerTrustPolicy.certificates(),
validateCertificateChain:true,
validateHost:true
),
"insecure.expired-apis.com": .disableEvaluation
]
letsessionManager =SessionManager(
serverTrustPolicyManager:ServerTrustPolicyManager(policies: serverTrustPolicies)
)
过滤自己的域名-> "test.example.com"
如果你选择证书 请忽略上述.
觉得不错 ,点个赞噻