Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cordova-debug-adapter] Error: Unable to find web view #54

Closed
Ritzlgrmft opened this issue Mar 9, 2016 · 3 comments
Closed

[cordova-debug-adapter] Error: Unable to find web view #54

Ritzlgrmft opened this issue Mar 9, 2016 · 3 comments

Comments

@Ritzlgrmft
Copy link

On my Mac, I am able to execute cordova build or cordova runwithout problems. But when it comes to debugging, I always get the error

[cordova-debug-adapter] Error: Unable to find web view

In the debug console, the last output is

Configuring debugging proxy

According to the documentation of ios_webkit_debug_proxy, I should see the connected devices on http://localhost:9221. But this page can be displayed only, when I start ios_webkit_debug_proxy manually in the terminal:

$ios_webkit_debug_proxy
Listing devices on :9221
Connected :9222 to SIMULATOR (SIMULATOR)

But when I try debugging, I still get the same error.

The configuration in my launch.json is

{
  "name": "Attach to running iOS on simulator",
  "type": "cordova",
  "request": "attach",
  "platform": "ios",
  "target": "emulator",
  "port": 9220,
  "sourceMaps": true,
  "cwd": "${workspaceRoot}"
}

I was wondering, that here the port is 9220, but the proxy tells something with 9222. Therefore I changed the port in launch.json, too. But this produces only another error:

[cordova-debug-adapter] Error: Unable to find iOS target device/simulator. Try specifying a different "port" parameter in launch.son

I am using the following versions:

  • Cordova Tools: 1.0.4
  • ideviceinstaller: 1.1.0_2
  • iso-webkit-debug-proxy: 1.6
@MSLaguana
Copy link
Member

The port specified in launch.json (when targeting iOS) is supposed to be a currently-unused port that we can create a new instance of ios-webkit-debug-proxy on. ios-webkit-debug-proxy then listens on additional ports (such as 9222) for different devices and simulators that it connects to.

The reason that you couldn't see anything on port 9221 is we changed the default port away from 9221 since it might be in use for other reasons (it's the default chrome-debugging port), so you would need to check on port 9220, and we also clean up ios-webkit-debug-proxy when we stop debugging.

To try and troubleshoot your problem, could you please do the following:

  • Look in platforms/ios/build/emulator/ after building at least once and make sure that there is only one file with the name *.app, for example HelloCordova.app. We will attempt to find an app on the simulator/device based on this name.
  • Start ios-webkit-debug-proxy manually like you did before, and take note of where it mounts the simulator; for example above it said it connected the simulator to 9222. While ios-webkit-debug-proxy and your app are both running, run curl localhost:9222/json, using the appropriate port number. That will list out the apps it found running on the simulator, and we can check to make sure it lists your app there.

@Ritzlgrmft
Copy link
Author

Thanks for your detailed reply!
I have only one *.app file in the build/emulator directory. The returned json is:

[{
   "devtoolsFrontendUrl": "/devtools/devtools.html?ws=localhost:9222/devtools/page/1",
   "faviconUrl": "",
   "thumbnailUrl": "/thumb/file:///Users/markus/Library/Developer/CoreSimulator/Devices/2FC388A4-7F27-4692-94A3-618B5C48C8FB/data/Containers/Bundle/Application/951C023C-66A5-4D5D-BDC8-996BCC017368/Rezepte%20M&M.app/www/index.html",
   "title": "Rezepte von M&M",
   "url": "file:///Users/markus/Library/Developer/CoreSimulator/Devices/2FC388A4-7F27-4692-94A3-618B5C48C8FB/data/Containers/Bundle/Application/951C023C-66A5-4D5D-BDC8-996BCC017368/Rezepte%20M&M.app/www/index.html",
   "webSocketDebuggerUrl": "ws://localhost:9222/devtools/page/1",
   "appId": "PID:20216"
}]

The returned URLs made me think a little bit. My app name (the name tag in config.xml) contained a blank as well as an ampersand. I removed both, and now I am able to debug.

If I remember right, taco complained also about the ampersand. Even though the app was working.

Now I am using the simple app name, and I am searching for a way to change the display name.

@MSLaguana
Copy link
Member

The space should work fine (we url encode the name to account for that) but I don't believe that ampersands are permitted since they turn up in places like the above and cause trouble. In this case we were expecting the ampersand to be encoded to "%26" in the url, but that doesn't seem to be the case, so we didn't detect the app as yours.

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

No branches or pull requests

3 participants