First, to ensure real machine and pc to ensure that in the same network
Red judged according to what he is wrong
, for example, can not connect to the remote prompt service, that you not in the same network
Tip 500 ip not possible configurations
Set ip method
Shaking the phone ---> Dev Settings ---> debug server host & port for device
Then enter your ip and port number
, for example:
192.168.1.18:8081
对于iOS真机来说,需要打开 [`RCTWebSocketExecutor.m`](https://github.com/facebook/react-native/blob/master/Libraries/WebSocket/RCTWebSocketExecutor.m)文件,然后将其中的"localhost"改为你的电脑的IP地址,最后启用开发者菜单中的"Debug JS Remotely"选项。 对于Android 5.0+设备(包括模拟器)来说,将设备通过USB连接到电脑上后,可以使用[`adb`命令行工具](http://developer.android.com/tools/help/adb.html)来设定从设备到电脑的端口转发: `adb reverse tcp:8081 tcp:8081` 如果设备Android版本在5.0以下,则可以在开发者菜单中选择"Dev Settings - Debug server host for device",然后在其中填入电脑的”IP地址:端口“。
iOS project loads the resource bundles for remote resources (resource package this machine ip react-native services provided)
Run the program
shake
Select the remote js debugging
browser then enter http: // localhost: 8081 / debugger -ui / address (official website says), but I have to enter the ip can.
Then you can see the log in the console
Forward a link: https: //www.jianshu.com/p/620ea3fe1f25
Link: https: //www.jianshu.com/p/4bcdfa43d588