3

I am using react-native to build an app. I created a new project yesterday and ran it on my iPone 6s and I could open the developer menu by shaking the device to enable hot reloading.

Today, when I started the app via react-native run-ios and opened the xcodeproject and ran it on my phone, the developer menu had only four options. It did not have the tab for hot reloading.

If I tap the the Debug JS Remotely option, I receive the following error

WebSocket connection failed with error Error Domain=NSPOSIXErrorDomain Code=61 "The operation couldn’t be completed. Connection refused"
7
  • 1
    Are you sure you have the right IP on RCTWebSocketExecutor.m file? Open up RCTWebSocketExecutor.m file and try changing localhost to the ip of your pc. Shake your device and Debug JS Remotely. Hope it helps. Jul 21, 2016 at 17:20
  • Yes, this is the code - (void)setUp { if (!_url) { NSUserDefaults *standardDefaults = [NSUserDefaults standardUserDefaults]; NSInteger port = [standardDefaults integerForKey:@"websocket-executor-port"] ?: 8081; NSString *host = [[_bridge bundleURL] host]; if (!host) { host = @"localhost"; } NSString *URLString = [NSString stringWithFormat:@"http://%@:%zd/debugger-proxy?role=client", host, port]; _url = [RCTConvert NSURL:URLString]; } Jul 21, 2016 at 17:35
  • Can we debug this over gmail or something? Maybe I can send you the project. Jul 21, 2016 at 17:36
  • Do you have github account? Is it possible to push your code to a github repository? Jul 21, 2016 at 17:50
  • I do, but it's on a private account. Just add me on [email protected] Can explain in more details. Jul 21, 2016 at 17:55

1 Answer 1

1

I'm not sure which version this feature was released in, but it is no longer neccessary to edit RCTWebSocketExecutor.m. Recent versions of react native use xip.io to configure this. If you are on the same wifi network as the device you should have no issue using remote debugging. Make sure you're on the same wifi network.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.