Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 237
Assaf Sheep Avatar asked Mar 27 '15 17:03

Assaf Sheep


People also ask

Can't connect to development server React Native iOS device?

Try this. Open another terminal and run, react-native start — reset-cache. Then run, react-native run-android on your current terminal.

Does React Native app work on iPad?

In other words, with React Native we can create an app that can support not only iPhone or Android phones but also iPad, Android tablets.

Can I use React Native for iOS development?

React Native combines the best parts of native development with React, a best-in-class JavaScript library for building user interfaces. Use a little—or a lot. You can use React Native today in your existing Android and iOS projects or you can create a whole new app from scratch.


Video Answer


1 Answers

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.

like image 178
tadeuzagallo Avatar answered Sep 24 '22 09:09

tadeuzagallo