title: iOS 8 didReceiveAuthenticationChallenge not getting called for WKWebView Objective C
body: <p>I am new to iOS development.  I have a project where I have to use WKWebView instead of UIWebView.  Its a simple webpage with javascript to Objective-C and other way round integration.  It is working fine except when I try to open a server with self-signed certificate.  On Safari it shows a dialog box where we can choose to continue.  However on my Application I cannot bypass this.</p>
  
  <p>For some reason I have to run it with self-signed certificate.</p>
  
  <p>The Delegate method didReceiveAuthenticationChallenge is never called.  Other delegate methods are working fine.  I know didReceiveAuthenticationChallenge is depreciated in iOS8 but can someone please tell me the workaround for this.  As I am a newbie so a complete working delegate method and/or any other changes in the code will be highly appreciated.</p>
  
  <pre><code>NSURL *url = [NSURL URLWithString:@"https://mywebsite.com/Default.aspx"];
  
  NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
  
  [[self webView] loadRequest:request];
  
  }
  
  // And the delegate method that is not getting called is 
  - (void)webView:(WKWebView *)webView
  didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
  completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler {
      SecTrustRef serverTrust = challenge.protectionSpace.serverTrust;
      CFDataRef exceptions = SecTrustCopyExceptions(serverTrust);
      SecTrustSetExceptions(serverTrust, exceptions);
      CFRelease(exceptions);
  
  completionHandler(NSURLSessionAuthChallengeUseCredential,
                    [NSURLCredential credentialForTrust:serverTrust]);
  </code></pre>
  
  <p>}</p>