针对didReceiveAuthenticationChallenge的WKWebView iOS 10.3崩溃? [英] WKWebView iOS 10.3 crash for didReceiveAuthenticationChallenge?

查看:2776
本文介绍了针对didReceiveAuthenticationChallenge的WKWebView iOS 10.3崩溃?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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)
    }
}

根据崩溃情况,崩溃发生在线信息 接收方没有发送挑战。

According to crashlytics crash is happening on line with info The challenge was not sent by the receiver.

    challenge.sender?.useCredential(credential, forAuthenticationChallenge: challenge)

感谢任何帮助。这仅在iOS 10.3上发生。我猜有些用户已经测试并且正在体验这一点。

Any help is appreciated. This happens only on iOS 10.3. I guess some users have beta and are experiencing this.

推荐答案

对我来说同样的问题,我通过评论此行来修复它

Same problem for me, I fixed it by commented this line

//    challenge.sender?.useCredential(credential, forAuthenticationChallenge: challenge)

这篇关于针对didReceiveAuthenticationChallenge的WKWebView iOS 10.3崩溃?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆