如何以编程方式读取wkwebview的控制台日志 [英] how to read console logs of wkwebview programatically

查看:135
本文介绍了如何以编程方式读取wkwebview的控制台日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以编程方式阅读以我的WkWebview加载的webapp的控制台日志。

I am trying to read the console logs of webapp that is loaded in my WkWebview programatically.

到目前为止,在我的研究中,这是不可能的。

so far in my research its not possible.

任何帮助实现这一目标都将受到赞赏!

Any help in achieving this would be appreciated !

推荐答案

请使用这个美丽的 - app Bridge

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
}

这篇关于如何以编程方式读取wkwebview的控制台日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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