Saturday, September 9, 2017

Cordova - Safari iPhone remote inspection disconnects

Leave a Comment

I'm using the Safari Web Inspector to remote debug a Cordova app I'm building. Previously this has worked like a charm, but now I've run into an issue. After launching the inspector, after a couple of seconds it seems like the web inspector disconnects from the device. The inspector is still open, but the inspector wont update, and elements on the device wont be highlighted anymore when hovered in the inspector (this works for the first couple of seconds). I'm able to get it running for a couple of seconds again by closing the inspector and launching it again.

I've tried debugging using Chrome and ios_webkit_debug_proxy instead, which doesn't disconnect. However, this has other issues which makes it a none viable solution.

I've tried using Safari Technology Preview (11.0 R35) as well as the current stable version of Safari (10.1.2), but the issue occurs in both of them. I've also tried switching the lightning cable and USB-port on my computer, which doesn't make any difference.

I found that the following error is logged (using the Console app) when the inspector seems to disconnect:

RWIServiceLockdownConnection: Disconnecting because we failed to read a message from webinspectord. This could mean almost anything. 

This does seem to have something to do with Cordova, since the error doesn't occur when I inspect a regular page Mobile Safari page.

What could cause this, and how do I resolve it?

1 Answers

Answers 1

Try setting a global hotkey:

  1. Go to System Preferences -> Keyboard -> Shortcuts -> App Shortcuts.

  2. Add a hotkey, whatever keys you want (e.g. Cmd + Alt + I) and match that hotkey to your cordova’s main html file (e.g. index.html).

  3. Launch Cordova App.

  4. Open Safari WI & close it.

  5. Re-launch Safari WI with quick hotkey shortcut set above.

  6. Close & re-open cordova app, Safari WI should keep debugging.

Also, as stated in comments, try keeping Xcode open.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment