【发布时间】:2017-02-21 18:17:26
【问题描述】:
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,崩溃发生在与信息一致 挑战不是由接收方发送的。
challenge.sender?.useCredential(credential, forAuthenticationChallenge: challenge)
感谢任何帮助。这仅在 iOS 10.3 上发生。我猜有些用户有测试版并且正在经历这个。
【问题讨论】:
-
有人解决了这个问题吗?我面临同样的问题。请帮忙
标签: ios iphone authentication wkwebview ios10.3