简体   繁体   English

在UIWebView中的Safari Web Inspector中查看Javascript源

[英]Viewing Javascript source in Safari Web Inspector in a UIWebView

My iOS app includes a UIWebView which runs some Javascript. 我的iOS应用程序包含一个运行某些Javascript的UIWebView。 I am able to attach Safari web inspector to my apps UIWebView instance and have the debugger invoked when a breakpoint is hit, however I am not able to view the actual javascript code. 我能够将Safari Web检查器附加到我的应用程序UIWebView实例上,并在遇到断点时调用调试器,但是我无法查看实际的javascript代码。

I am able to see the variables and the call stack, but the source code window is blank. 我能够看到变量和调用堆栈,但是源代码窗口为空白。

Is there something that needs to be done in order to make the source code visible? 为了使源代码可见,是否需要做些什么?

Switching to the DOM tree view does show the contents of the page, but this is not source level javascript debugging. 切换到DOM树视图确实会显示页面的内容,但这不是源级别的javascript调试。

Is it possible to actually have the source code for the Javascript being debugged visible in the web inspector? 是否可以在Web检查器中实际显示要调试的Javascript的源代码?

The reason that the code is not visible is because I was making use of the loadHTMLString method on the UIWebView. 该代码不可见的原因是因为我在UIWebView上使用了loadHTMLString方法。

Making use of a file URL and loadRequest to load the request allows for the code to become visible. 利用文件URL和loadRequest加载请求可以使代码可见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM