ios 为什么 Web Inspector 显示“没有可检查的应用程序”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21844851/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 23:27:55  来源:igfitidea点击:

Why is Web Inspector showing me "no inspectable applications"?

iosiphonemacosweb-inspector

提问by Vish

Background

背景

My company recently made a shift to app development. While developing and Q/Aing on Android was relatively painless, iOS, on the other hand is proving to be a pain.

我的公司最近转向应用程序开发。虽然在 Android 上开发和问答相对轻松,但另一方面,iOS 被证明是一种痛苦。

The task involves looking at the page source of our app (which has a custom browser). I heard that Web Inspector is a great tool, so I went with it.

该任务涉及查看我们的应用程序(具有自定义浏览器)的页面源。我听说 Web Inspector 是一个很棒的工具,所以我选择了它。

Problem

问题

  • First of all, Web Inspector has been able to detect the custom browser before.
  • But quite frequently, Web Inspector's menu gives the "No Inspectable Applications" prompt.
  • This happens with the exact same version of the app that worked earlier.
  • There seems to be no trigger whatsoever; yesterday Web Inspector was working with the custom browser, and then after a few hours (during which I may have disconnected and reconnected the iPhone) it stopped working.
  • 首先,Web Inspector 之前已经能够检测到自定义浏览器。
  • 但经常,Web Inspector 的菜单给出“No Inspectable Applications”提示。
  • 这发生在与之前工作的应用程序完全相同的版本中。
  • 似乎没有任何触发器;昨天 Web Inspector 正在使用自定义浏览器,然后几个小时后(在此期间我可能断开并重新连接了 iPhone)它停止工作。

I have not been able to figure out why despite breaking my head for a week.

尽管我断了一个星期的头,但我还是不明白为什么。

Observations

观察

I have an iPhone 4S running iOS 7.0.4. My Mac Mini has Safari 7.0.

我有一台运行 iOS 7.0.4 的 iPhone 4S。我的 Mac Mini 有 Safari 7.0。

In the phone options

在电话选项中

  • Web Inspectoris turned on in the iPhone menu
  • All privacy modes are set to off - Do Not Track, Block Cookies, etc. (this question)
  • Javascript is turned on in the phone.
  • Web Inspector在 iPhone 菜单中打开
  • 所有隐私模式都设置为关闭Do Not Track, Block Cookies等(这个问题
  • 手机中的 Javascript 已打开。

In Safari on my Mac Mini - Develop menu is enabled (obviously)

在 Mac Mini 上的 Safari 中 - 启用了开发菜单(显然)

More observations

更多观察

  • iOS Safari is detected by Web Inspector.
  • Web Inspector 检测到 iOS Safari。

So, how do I go about debugging this? What could be a possible cause and what could be the solution?

那么,我该如何调试呢?可能的原因是什么,解决方案是什么?

回答by jonfer

I was having the same problem, it was cause I was running iOS 8,fixed by updating Safari to 7.1 .

我遇到了同样的问题,这是因为我运行的是 iOS 8,通过将 Safari 更新到 7.1 来修复。

回答by Steve Seeger

An update for iOS 9 (using OSX El Capitan):

iOS 9 更新(使用 OSX El Capitan):

On your mobile device under Settings -> Safari -> Fraudulent Website Warning = OFF [default = ON]

在您的移动设备上的设置 -> Safari -> 欺诈网站警告 = 关闭 [默认 = 开启]

回答by infografnet

For me to make it work I needed to go into iPhone's Settings -> Safari > Advanced and enable Web Inspectoroption. (iOS 9.1)

为了让它工作,我需要进入 iPhone 的设置 -> Safari > 高级并启用Web Inspector选项。(iOS 9.1)

回答by Michikawa

I was having exactly same trouble. I managed to correct the situation by clearing the cookies and history from the mobile Safari menu. After this, it showed up in the Mac Develop menu.

我遇到了完全相同的麻烦。我设法通过清除移动 Safari 菜单中的 cookie 和历史记录来纠正这种情况。之后,它出现在 Mac 开发菜单中。

Hopefully this will correct your situation as well.

希望这也能纠正你的情况。

回答by Quadrivium

this is probably an oversight where someone forgot to include the ios 8 version of Mobile Safari as an inspectable application. Get with it guys. I was able to connect my iPad to a MacMini we have with Yosemite Beta.

这可能是有人忘记将 ios 8 版本的 Mobile Safari 作为可检查应用程序的疏忽。伙计们。我能够将我的 iPad 连接到我们使用 Yosemite Beta 的 MacMini。

So I have also discovered that the web inspector in Yosemite Beta doesn't inspect well. I am able to Breakpoint in Javascript, but items are not inspectable in the inspection pane. The console does report correct information. Don't be fooled as I was! To inspect the value of something in this web inspector you must access the values via the console, type in the variable and it will return the result it has correctly.

所以我还发现 Yosemite Beta 中的网络检查器检查效果不佳。我可以在 Javascript 中设置断点,但无法在检查窗格中检查项目。控制台确实报告了正确的信息。不要像我一样被愚弄!要检查此 Web 检查器中某些内容的值,您必须通过控制台访问这些值,输入变量,它将正确返回结果。

回答by Vish

As it happens, the solution that worked for me (reliably) was:

碰巧,对我有用的解决方案(可靠地)是:

  • Build the app from source locally (in Xcode)
  • Deploy it to the iPhone, connected through USB
  • 从本地源代码构建应用程序(在 Xcode 中)
  • 部署到iPhone,通过USB连接

For some reason, Web Inspector works reliably when the app is started this way. I am unable to figure out why, but it works. Comments welcome.

出于某种原因,当应用程序以这种方式启动时,Web Inspector 可以可靠地工作。我无法弄清楚原因,但它有效。欢迎评论。

回答by Ryan Hemphill

Here's a possibility, mostly because I just ran into this myself...

这是一种可能性,主要是因为我自己刚刚遇到了这个......

Is your browser set for private browsing?

您的浏览器是否设置为隐私浏览?

If it is, turn that off! You can't use the inspector while it's on.

如果是,请关闭它!检查器打开时您不能使用它。