首页 > 解决方案 > console.log 日志未显示在 Xcode 调试记录器中,也未显示在 Safari 调试记录器中

问题描述

我在 cordova/www 下创建了 index.html 文件。通过 iOS 模拟器运行它并执行以下操作:

<!DOCTYPE html> <html> <head>   <title>Title</title> </head> <body>

    <h1>Hello World1</h1>
    <h2>Test this out</h2>
    <h2 id="test"></h2>

    <script>
      console.log("Test")
      document.getElementById("test").innerHTML = "text string"
    </script>

</html>

HTML 输出显示在模拟器中,并且<h2 id="test"></h2>还填充了“文本字符串”字符串 - 表示 JS 已启用。

但是,它console.log("Test")并没有出现在任何地方——不是在 Xcode 调试中,也不是在我从 Safari 运行的调试中。

Howcome 以及如何解决此问题

标签: iosxcodecordovadebuggingios-simulator

解决方案


推荐阅读