Skip to content

Instantly share code, notes, and snippets.

@ewanharris
Created July 25, 2019 14:55
Show Gist options
  • Save ewanharris/c676d0509d7b21c5f41572fa7d98430b to your computer and use it in GitHub Desktop.
Save ewanharris/c676d0509d7b21c5f41572fa7d98430b to your computer and use it in GitHub Desktop.
Debugging iOS connection for debugger
  1. With the simulator launched, lookup the simulator socket
    • lsof -aUc launchd_sim
  2. Look for a name that ends in com.apple.webinspectord_sim.socket, copy that.
  3. Spawn ios_webkit_debug_proxy passing in that socket prefixed with unix:
    • ios_webkit_debug_proxy -s unix:<socket from step 2>
    • It should output something like the below
$ios_webkit_debug_proxy -s unix:/private/tmp/com.apple.launchd.y7tX5zeZ81/com.apple.webinspectord_sim.socket
Listing devices on :9221
Connected :9222 to SIMULATOR (SIMULATOR)
  1. Connect to http://localhost:9221/json in the browser
    • You should see your simulator/devices listed
  2. Open the application on your simulator
  3. Take the url property from SIMULATOR entry on http://localhost:9221/json and open <url>/json in your browser
    • You should see some output like below
{
	"devtoolsFrontendUrl": "/devtools/devtools.html?ws=localhost:9222/devtools/page/2",
	"faviconUrl": "",
	"thumbnailUrl": "/thumb/",
	"title": "JSContext",
	"url": "",
	"webSocketDebuggerUrl": "ws://localhost:9222/devtools/page/2",
	"appId": "PID:76060"
}
@raybelisle
Copy link

So when I try to list the simulators using http://localhost:9221/json, it doesn't seem to return something valid...???

I am getting:
[{
"deviceId": "SIMULATOR",
"deviceName": "SIMULATOR",
"deviceOSVersion": "0.0.0",
"url": "localhost:9222"
}]

Should the deviceOSVersion be correct? Also, when you say 'Start the app', I am expecting that when I debug it should be installing to the sim, but doesn't get installed. And the sim seems to freeze. ie. stuck on the main screen and can't swipe to other screens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment