最新更新 Xcode (10.2) 后,Web Inspector 不工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/55369149/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
After latest update of Xcode (10.2), Web Inspector is not working
提问by Orville Chomer
I've posted this as a bug on Apple's Bug Report site. I thought I'd post here too and see what I can find out as to how I might fix this...
我已将此作为错误发布在 Apple 的错误报告站点上。我想我也会在这里发帖,看看我能找到什么来解决这个问题......
Area:
区域:
Debugging WKWebView with Xcode using Web Inspector in Safari. I'm running on MacOS Mojave Version: 10.14.3 (18D42).
在 Safari 中使用 Web Inspector 使用 Xcode 调试 WKWebView。我在 MacOS Mojave 版本上运行:10.14.3 (18D42)。
Summary:
概括:
After letting upgrade of Xcode run (Version 10.2 (10E125)), when I pick the proper Device option from Safari's [Develop] menu (Version 12.0.3 (14606.4.5) of Safari), the Web Inspector comes up while running the app like before, but it displays as basically blank and useless.
在运行 Xcode 升级(版本 10.2 (10E125))后,当我从 Safari 的 [Develop] 菜单(Safari 的版本 12.0.3 (14606.4.5))中选择正确的设备选项时,Web Inspector 在运行应用程序时出现像以前一样,但它显示为基本空白且无用。
Steps to Reproduce:
重现步骤:
1- start iOS app in the Simulator that has a WKWebView that is successfully displaying a web page that has runnable JavaScript in it.
(Figure 1) Here I've picked the iPhone 6 Simulator in Xcode
1- 在具有 WKWebView 的模拟器中启动 iOS 应用程序,该应用程序成功显示了一个包含可运行 JavaScript 的网页。
(图 1)这里我选择了 Xcode 中的 iPhone 6 Simulator
.
(Figure 2) App running in simulator... WKWebView takes whole screen
.
(图2) App 在模拟器中运行... WKWebView 占据整个屏幕
.
(Figure 3) screen after clicking [Run Db Startup Code] button (notice new info under "Test Info:")
.
(图3)点击【Run Db Startup Code】按钮后的画面(注意“Test Info:”下的新信息)
.
(Figure 4) JS code that runs when this button is clicked.
. 2-Go to Safari window and pick [Develop] menu.
. 2-转到Safari窗口并选择[开发]菜单。
3- Pick Simulator option for the device like: Simulator -- iPhone 6 -- iOS 12.2 (16E226)
3- 为设备选择模拟器选项,例如:模拟器 -- iPhone 6 -- iOS 12.2 (16E226)
4- Pick the "index.html" option
(Figure 5) Picking option in Safari after app in iPhone Simulator has been started
4-选择“index.html”选项
(图5)iPhone模拟器中的应用程序启动后Safari中的选择选项
.
.
5- Web Inspector comes up, but none of the page's resources are listed (including index.html)
(Figure 6) Web Inspector brought up ... this is the Debugger tab. Nothing appears.
5- Web Inspector 出现,但没有列出任何页面资源(包括 index.html)
(图 6)Web Inspector 出现......这是调试器选项卡。什么都没有出现。
.
.
(Figure 7) Web Inspector, Resources tab... also blank. Clicking the Refresh button above the Network tab does nothing.
(图 7)Web Inspector、Resources 选项卡...也是空白。单击“网络”选项卡上方的“刷新”按钮不执行任何操作。
.
.
6 - Clicking the Web Inspector's refresh button does nothing
6 - 单击 Web Inspector 的刷新按钮什么也不做
Expected Results:
预期成绩:
Resources to load, to be able to set break-points on JavaScript lines of code. to have JS code stopped on any debugger; statement to be able to step through JS code and examine current JS variable values.
要加载的资源,以便能够在 JavaScript 代码行上设置断点。在任何调试器上停止 JS 代码;语句能够单步执行 JS 代码并检查当前的 JS 变量值。
Actual Results:
实际结果:
As said before, the web inspector window comes up basically empty (like there is no page loaded into the WKWebView at all (even though there is and I can visually see that JS code runs when I click buttons on test interface).
如前所述,Web 检查器窗口基本上是空的(就像根本没有加载到 WKWebView 中的页面一样(即使有并且我可以在单击测试界面上的按钮时直观地看到 JS 代码运行)。
Note: If I try running on actual tethered device, NO option shows up in Safari's [Developer] menu!
注意:如果我尝试在实际的系留设备上运行,Safari 的 [Developer] 菜单中不会显示任何选项!
回答by raman
Managed to resolve it updating the OS to 10.14.4 and correspondingly the Safari to 12.1.
设法解决它更新操作系统到 10.14.4 和相应的 Safari 到 12.1。
回答by rob_james
Nothing worked for me... but then I found Safari Technology Preview https://developer.apple.com/safari/technology-preview/- installing this latest version of safari did the trick for me.
没有什么对我有用......但后来我发现了 Safari Technology Preview https://developer.apple.com/safari/technology-preview/- 安装这个最新版本的 safari 对我有用。
回答by Christoph
After updating to iOS 13 and Safari 13, the connected iPhone did not show up in Safari either. The solution was also for me, to clear the trusted computers on the iPhone under the developer settings and reconnect the iPhone: clear the trusted computers on the iPhone
更新到 iOS 13 和 Safari 13 后,连接的 iPhone 也没有出现在 Safari 中。解决方法也是给我的,在开发者设置下清除iPhone上的可信电脑,重新连接iPhone:清除iPhone上 的可信电脑
回答by Jan van de Loo
I had the same issue with a remote device (simulator didn't work either). A system update of my macOS (including Safari) fixed it for me.
我在远程设备上遇到了同样的问题(模拟器也不起作用)。我的 macOS(包括 Safari)的系统更新为我修复了它。
Seems like the latest iOS Safari Update was incompatible with the last macOS Safari.
似乎最新的 iOS Safari 更新与上一个 macOS Safari 不兼容。
回答by George Valkov
iOS 13: for me the solution was to Clear Trusted Computers in Settings, Developer, then reconnect the USB cable, tap Trust this computer, and my iPhone instantly showed in Safari's Develop menu.
iOS 13:对我来说,解决方案是在“设置”、“开发人员”中清除“受信任的计算机”,然后重新连接 USB 电缆,点击“信任这台计算机”,我的 iPhone 立即显示在 Safari 的“开发”菜单中。