简体   繁体   English

在iOS 8和iOS 9中调试移动Safari

[英]Debugging mobile Safari in iOS 8 and iOS 9

After switching to new versions of iOS, I've not been able to debug my web app from OS X Safari to my iPhone Safari browser. 切换到新版本的iOS后,我无法将我的Web应用程序从OS X Safari调试到我的iPhone Safari浏览器。 My iPhone shows up but I get no options. 我的iPhone显示但我没有选择。

On my iPhone, I have allowed the web inspector. 在我的iPhone上,我已经允许网络检查员。

中文:开发人员 - > Johans iPhone  - >没有可检查的应用程序

English: Developer -> Johans iPhone -> No inspectable applications. 中文:开发人员 - > Johans iPhone - >没有可检查的应用程序。

If I, however save my web app to my home screen - I can get the developer tools for that app, but it's not what I want at this occasion. 如果我将我的网络应用程序保存到我的主屏幕 - 我可以获得该应用程序的开发人员工具,但这不是我想要的。 Unfortunately I have no other iOS / OS X devices to test with, so any help would be greatly appreciated. 不幸的是我没有其他iOS / OS X设备可以测试,所以任何帮助将不胜感激。

Though this is an old question, it should be mentioned somewhere in the answer that you actually have to enable remote inspection on the iPhone first before anything will show up. 虽然这是一个老问题,但在答案的某处应该提到你实际上必须首先启用iPhone上的远程检查才能显示任何内容。

Go to: Settings --> Safari --> Advanced --> Web Inspector 转到:设置 - > Safari - >高级 - > Web Inspector

启用Web Inspector

Debugging iOS 8 mobile Safari requires desktop Safari 7.1 , which is only available with OS X 10.9.5 or greater . 调试iOS 8移动版Safari 需要桌面版Safari 7.1 ,它仅适用于OS X 10.9.5或更高版本

What you need to do is: 你需要做的是:

  1. Update (via Apple menu->Software Update) to OS X 10.9.5 (if you haven't already) 更新(通过Apple菜单 - >软件更新)到OS X 10.9.5(如果您还没有)
  2. Once you've done that, you should see the Safari 7.1 in the list of pending updates 完成后,您应该在待处理更新列表中看到Safari 7.1

Once done, you should see be able to debug as usual via desktop Safari. 完成后,您应该能够通过桌面Safari像往常一样进行调试。

Also for iOS 9: 也适用于iOS 9:

On your mobile device under Settings -> Safari -> Fraudulent Website Warning = OFF [default = ON] 在您的移动设备上的设置 - > Safari - >欺诈网站警告=关闭[默认=开]

Even with OS X 10.9.5 and Safari > 7.1 I wasn't able to debug mobile Safari on an iPad with iOS 8. 即使使用OS X 10.9.5和Safari> 7.1,我也无法在iOS 8的iPad上调试移动Safari。

It turned out that I had previously rejected a dialog on the iPad that asked whether to "trust this computer". 事实证明,我之前拒绝了iPad上的一个对话框,询问是否“信任这台电脑”。 The following steps helped: 以下步骤有助于:

  1. Power down device. 断电装置。
  2. Open iTunes on computer. 在计算机上打开iTunes。
  3. Connect device to computer. 将设备连接到计算机。
  4. Respond to computer question to let device access iTunes. 回应计算机问题让设备访问iTunes。
  5. Turn on device. 打开设备。

It will ask you to confirm to trust the computer again. 它会要求您确认再次信任该计算机。 Accept and you should be able to debug as usual. 接受,您应该能够照常调试。

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

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