How to read console logs of WKWebView programmatically

I am trying to read the console logs of a webapp that is loaded in my WKWebView programmatically.

So far in my research it's not possible.

How can I achieve this?


  • Please use this beautiful in-app "Bridge"


    self.webView = [[WBWKWebView alloc] initWithFrame:self.view.bounds];
    self.webView.JSBridge.interfaceName = @"WKWebViewBridge";
    WBWebDebugConsoleViewController * controller = [[WBWebDebugConsoleViewController alloc] initWithConsole:_webView.console];

    Then , you can use the delegate method:

    - (void)webDebugInspectCurrentSelectedElement:(id)sender
    // To use the referenced log values