func webView(webView: WKWebView, didReceiveAuthenticationChallenge challenge: NSURLAuthenticationChallenge, completionHandler: (NSURLSessionAuthChallengeDisposition, NSURLCredential?) -> Void) {
var user: String?
var password: String?
switch providerID {
case "197": // ABC Stagging
user = "ABC"
password = "abc"
default:
break
}
if let user = user, password = password {
let credential = NSURLCredential(user: user, password: password, persistence: NSURLCredentialPersistence.ForSession)
challenge.sender?.useCredential(credential, forAuthenticationChallenge: challenge)
completionHandler(NSURLSessionAuthChallengeDisposition.UseCredential, credential)
}
}
根据 crashlytics,崩溃发生在与 info 一致的情况下,接收方未发送挑战。
challenge.sender?.useCredential(credential, forAuthenticationChallenge: challenge)
任何帮助表示赞赏。这仅在 iOS 10.3 上发生。我猜有些用户有测试版并且正在经历这个。