IOS: proposedCredentials 和 URLCredential 之间的差异用于信任

IOS: Difference between proposedCredentials and URLCredential for trust

URLSession:task:didReceiveChallenge:completionHandler:, is there a difference between using .proposedCredential vs URLCredential(trust:)服务器信任对象中挑战保护space?

这是在委托方法的完成处理程序中作为第二个参数传回,与.useCredentials

此处收到答复:https://forums.developer.apple.com/message/361609

Realistically there’s no difference here. For server trust authentication challenges, the system does not actually look at the trust object embedded in the credential you pass to the completion handler; all that matters is that you pass in something.

Having said that, I recommend that you stick on the well-trodden path and construct a new credential. I’m actually quite surprised that proposedCredential is even populated in this case.