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

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

Ankit Srivastava
  • 12,347
  • 11
  • 63
  • 115

1 Answers1

4

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

//    challenge.sender?.useCredential(credential, forAuthenticationChallenge: challenge)
StrawHara
  • 1,301
  • 19
  • 33