针对didReceiveAuthenticationChallenge的WKWebView iOS 10.3崩溃?

时间:2017-02-21 18:17:26

标签: ios iphone authentication wkwebview ios10.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)
    }
}

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

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

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

1 个答案:

答案 0 :(得分:2)

对我来说同样的问题,我通过注释这一行来修复它

$("#mytable th").each(function(){
   var cellText = $(this).html();
    alert(cellText);       
    $(".demo th").text(cellText);
});