Assaf Sheep Assaf Sheep - 3 months ago 41
React JSX Question

React Native on Ipad - Error - could not connect to development server

I'm using React-Native, when I run the AwesomeProject with Xcode and iPhone simulator everything works well, but when I connected my iPad and built the project on my iPad I receive an error on the iPad when the app starts:


"Could not connect to development server. Ensure node server is
running. The operation couldn't be completed (NSURLErrorDomain error
-1004)".


I also ensured that the node package is running. I even restarted Xcode and started it all over with running npm start.

Could you please assist?

Answer

On your AppDelegate.m you have to update the jsCodeLocation and replace localhost with your machine ip address.

Either that or bundle the compiled source into your application, which is commented as option 2 on AppDelegate.m as well. You download the compiled code, and add it to your Xcode project.

Comments