我还有两个错误,它们是相同的错误。不知道什么可能是错的。我甚至从源Alamofire doc复制并粘贴,并确保pod是最新的但同样的错误。
public func URLSession(session: NSURLSession, didReceiveChallenge challenge: NSURLAuthenticationChallenge, completionHandler: ((NSURLSessionAuthChallengeDisposition, NSURLCredential?) -> Void)) {
if sessionDidReceiveChallenge != nil {
completionHandler(sessionDidReceiveChallenge!(session, challenge)) // Missing argument for parameter #2 in call
} else {
completionHandler(.PerformDefaultHandling, nil)
}
}
答案 0 :(得分:1)
从它的外观来看。错误是说您缺少NSURLCredential的值。试试这个。
completionHandler(sessionDidReceiveChallenge!(session, challenge),nil)
答案 1 :(得分:0)
public func URLSession(session: URLSession, didReceiveChallenge challenge: URLAuthenticationChallenge, completionHandler: ((URLSession.AuthChallengeDisposition, URLCredential?) -> Void))
{
if let serverTrust = challenge.protectionSpace.serverTrust
{
completionHandler(.useCredential, URLCredential(trust: serverTrust))
}
else
{
completionHandler(.performDefaultHandling, nil)
}
}