Debugging mobile Safari in iOS 8 and iOS 9

2019-01-17 20:42发布

问题:

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. My iPhone shows up but I get no options.

On my iPhone, I have allowed the web inspector.

English: Developer -> Johans iPhone -> No inspectable applications.

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.

回答1:

Debugging iOS 8 mobile Safari requires desktop Safari 7.1, which is only available with OS X 10.9.5 or greater.

What you need to do is:

  1. Update (via Apple menu->Software Update) to OS X 10.9.5 (if you haven't already)
  2. Once you've done that, you should see the Safari 7.1 in the list of pending updates

Once done, you should see be able to debug as usual via desktop Safari.



回答2:

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.

Go to: Settings --> Safari --> Advanced --> Web Inspector



回答3:

Also for iOS 9:

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



回答4:

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.

It turned out that I had previously rejected a dialog on the iPad that asked whether to "trust this computer". The following steps helped:

  1. Power down device.
  2. Open iTunes on computer.
  3. Connect device to computer.
  4. Respond to computer question to let device access 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.