Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-Native: how to use "Remote JS Debugger" on real iOS-device?

I'm wondering if react-native's Remote Debugger mode would be possible also on real device. But it stops me with an error page stating

"Connecting to http://localhost:8081/debugger-proxy?role=client timed out"

The interesting fact here is that this URL won't also work on my developer machine.

Opening this URL (http://localhost:8081/debugger-proxy?role=client) in a browser on my developer machine with running packager.js will respond with:

Cannot GET /debugger-proxy?role=client

When I turn off Remote debugger, everything works as expected.

Steps to reproduce:

  1. react-native init testapp
  2. cd testapp/ios
  3. open the .xcodeproj-File with XCode
  4. Select my connected iPhone as target device
  5. Run the application

The application will fetch the source code from my local machine. In order to make this work, both, the iPhone-device and my iMac, are connected to the same WiFi.

enter image description here

The ReactNative-Application is executed on the iPhone as expected. With the shake-gesture I spawn the developer menu and select the option "Debug JS Remotely".

enter image description here

Now this error appears as mentioned above.

Following a side note in running-on-real device I changed the Host from localhost to the IP-Address of my Mac in RCTWebSocketExecutor.m, but this results in an endlos loop while fetching.

The Question is:

How can I use the Remote JS Debugging-Feature on real device?

enter image description here

Update

After further investigation I came to the conclusion that this might be a bug and opened the following issue on GitHub.

like image 776
delete Avatar asked Mar 30 '18 15:03

delete


1 Answers

In chrome browser, I have changed

localhost:19001/debugger-ui

to

192.168.0.4:19001/debugger-ui

and it worked. Replace 192.168.0.4 with your ip address.

like image 158
Thakur Ballary Avatar answered Sep 28 '22 07:09

Thakur Ballary