React-Native Could not connect to development server - ios

I've been testing my project on my iPhone6s and it worked perfectly. But today Xcode and Node.js keeps giving me the 'Unable to execute JS call: __fbBatchedBridge is undefined' error.
I'm sure the IP address is correct, my phone is under the same Wifi network with server. The simulator works fine with the server ip. To test if it is something wrong with the project I start another AwesomeProject and changed the IP but still not working. Anyone know any possible solutions?

I faced the same issue in my office Wifi network connection also. This is because of the router configuration. There are two ways to make it work.
Expose the local server using ngrok. But, It will be slow since it is sending everything to server.
Connect your phone using USB cable and type the following command in the computer adb reverce tcp:8081 tcp:8081

Related

How to connect to localhost on a real device in react native on iOS?

I have a server running on localhost:5000 on my desktop, and when I make http requests through my react-native app when running on the iOS simulation to it, it works. However, when I connect to a real device, the http requests don't work. What am I doing wrong? Is there something I have to configure?
localhost in your desktop is not the same ip of the localhost of your device.
Get the ip of your computer by typing ifconfig in a terminal, then replace localhost by this ip, you should type something like that in your device browser:
192.168.0.23:5000
Maybe my answer is too late but I ran into a similar situation today and I got it to work by running my node server using the IPv4 of my desktop and then making the request to that IP.
For example, I am running my nodejs development server at http://192.168.0.135:3000(local IP of my desktop) instead of localhost and then I make the fetch API request from my react-native app to http://192.168.0.135:3000/.
Just make sure your nodejs server and your app are on the same local network. My react-native server (metro bundler) is running on a separate PC also in the same wifi network.
If your are on macOS go to settings -> Wifi / and show more,
on bottom you see "IP address", it's your correct localhost for ios physical device !

The question is about localhost, Swift URL, NetBeans and Xampp

everyone, I have a question to ask about "localhost"
I am a newbie and use NetBeans and Xampp as DATABASE to connect with Swift.
I use "http://localhost/" as my URL on the simulator of Mac, which works fine.
But when I change to my physical device, it has an error " can not connect to the server", how can I solve this problem?
And another question, if one day I publish the APP, what URL should I use? Is it still "http://localhost/" or anything else? I am really confused, can someone give me some advice? I would really appreciate!
localhost is 127.0.0.1 address, used only in current machine.
When you using simulator, simulator run in same machine with server, it will success access 127.0.0.1 address.
If you using real device, please find your server ip with command ifconfig and use that in App.
Hope to help you.
As was written in the comments, http://localhost/ only works on the current device (similar if you are using http://127.0.0.1). The simulator is running on your Mac, so it will work.
Since the physical device is not on your Mac, it will not work. So, for testing, you might want to set up a test server on your computer or on another machine. Then, you would replace the URL with the IP address or hostname of the server. For production, you would need to set up a server or find a hosting service. Then, you would use the URL for whatever server you go with in your app instead of http://localhost/.

Test XCode app running on physical device with local server

I have searched high and low for a solution to this which I am sure must exist but I have failed to find one that works.
I am running XCode 7.3 and iOS 9.2 on an iPhone.
I have a test server running on 127.0.0.1:8000
I cannot get my app running on the iPhone to connect to either 127.0.0.1:8000 or 192.168.1.200:8000 (which is the local ip address of my server).
There must be a way to give the iPhone app access to the local server if only I knew how!
The best solution to this problem, that many app developers have, is to download ngrok which acts as a proxy website.
ngrok is insanely easy to use:
Download from https://ngrok.com/
Run: ngrok http 8000 in terminal (where 8000 is your port)
Cut and paste the displayed ngrok url (e.g. http://a021v2tc.ngrok.io) into your app
So simple. And works!
Check if iPhone connect the same wifi with your server.
You can use Fiddler as iPhone agent to get the detail error message.
There is the link how to capture traffic from IOS device.
here

Issue with Xcode Server: No services available

I'm trying to run a Xcode server with remote access.
I've been trying to log in from a client/node PC, with no success. There's a message with the IP and a warning "No services unavailable".
Is there something I'm missing here?
Screenshot is attached.
Thanks.
Since from attached picture everything is running perfectly locally, I'm almost sure that the problem is in your router. So on router in port forwarding you have to open:
For Xcode Integration the only ports needed are 20300,20343-20345
For Website 80,443
And you have to make sure that you're have global IP address

Error when testing app from mobile device - ERR_CONNECTION_REFUSED

After upgrading to OSX Yosemite, I can no longer test my app on a mobile device by using my development machine's (MacBook Pro) IP address. For example, I used to be able to view a Rails app on a phone by going to http://192.168.0.4:3000, but now I get the following error:
ERR_CONNECTION_REFUSED
I get the same error when testing an AngularJS app using the grunt server running at http://192.168.0.4:9000
Any help will be greatly appreciated.
It could help to bind the server to your local IP, like
rails s -p9000 -b192.168.0.4
to start your rails app
Consider giving a try to Pow. Its pretty simple to install, and a great solution to share a local development across multiple devices.
Like it explains in their homepage, you can install it with just :
curl get.pow.cx | sh. To prevent any errors, install in Terminal app outside a Tmux session.
And just symlink your app :
cd ~/.pow
ln -s /path/to/myapp
You can access your app at http://myapp.dev/, and at http://myapp.[your ip address].xip.io from another device.
Not a direct response to your issue, but an alternative to setting yourself a configuration in your preferences.
Turn IPv6 off. It Prevented me from connecting to my localhost from other computers on my LAN. And, with the newer versions of OSX there is no way to turn it off in the Network Preferences Panel so you have to do it from terminal.
Open Terminal and enter to turn it off:
networksetup -setv6off Wi-Fi
And this to turn it back on:
networksetup -setv6LinkLocal Wi-Fi
If you are connected via Ethernet or something else just run this command to list the available options:
networksetup -listallnetworkservices
and replace "Wi-Fi" with the appropriate device.
I don't have a mac, but that seems to be the server not accepting connections, if that is the case, it's only accepting localhost connections, try binding de server to accept all connections or bind it to 0.0.0.0 ip
Can you access that IP from Browser? are you sure your IP is in the same range with 192.168.0.4? It is your mobile device connected on the same network? Maybe you used internet sharing before update to Yosemite and now is off?
I think your IP address changed. Telnet from console(terminal) your I.P. port. If 192.168.0.4 is your real Ip then maybe add(as root or via sudo) an entry in /etc/host file an entry as 127.0.0.1 192.168.0.4. Restart network or reboot. Also you can try nmap ( on ip to see open ports). Nmap has been ported to OSX just google for installer.

Resources