I have been working on a react native project in Windows 10 for a while now using Expo to scan the given QR code and test the app on my IOS device. The other day I ran $expo start and everything seemed to go fine until I tried to load the app on my IOS device. I received this message:
Could not connect to server
I then "Run in Web Browser" which worked fine, so I tried accessing 127.0.0.1:19000 in my Iphone's browser (firefox) and it as well could not connect to server. My phone is connected via wifi which is 2.4 or 5g. I wasn't sure how this would effect this so I used a wifi adapter on PC to match which wifi connection phone and PC were on and that didn't help.
I am using react version 17.0.1, expo version 3.28.5, and "react-native": "https://github.com/expo/react-native/archive/sdk-38.0.0.tar.gz"
I have tried:
Turning off windows firewall
Using different Iphones to connect
npm install --global expo-cli
Changing Connection from "LAN" to "Local"
Reinstalling Node
Creating a System Variable called: "REACT_NATIVE_PACKAGER_HOSTNAME" with the value "192.168.2.108". This did change the LAN IP address as intended but it did not resolve the problem. I just got the same message with the new IP address.
This problem just started happening out of the blue and I'm not really sure what to do next. If you need any additional information I'd be happy to give it.
try to use
expo start --tunnel
When you get the message:
"Error loading DevTools ValidationError: "urlType" must be one of [exp, http, redirect, no-protocol]"
Just wait for a bit and the QR code for tunnel will appear. It does the same for me as well.
Related
I wasted a day and a half and still can't figure out what is going on and can't find any working solutions. I can't debug my react native application on a real device. It worked yesterday in the morning. Now it is not working. As for me, I didn't change anything. XCode always loads a pre-bundled file. I am on the same working wifi. There are no issues with emulators, only real device.
When I am creating a personal hotspot on my iPhone and connect through it - it works! But I don't want to use a personal hotspot, I want to use wifi.
What I tried:
1. Reload laptop
2. Reload Mobile
3. Change the IP address to the local inside of AppDelegate.m
4. Clean build
5. Remove and install node_modules
6. Kill -9 everything that runs on port 8081
7. Enable App Transport Security (Xcode)
8. Connect-disconnect the device
Go to Settings>Network>Advanced....>DNS
Add these two entries
8.8.8.8
8.8.4.4
If the entries field is disabled and you're not able to edit it, click on the 'Lock' icon in the bottom area of that window and enter the password to be able to make changes
Possible Duplicate:
Android Studio - Android Emulator Wifi Connected with No Internet
I'm starting to develop a react-native app, so almost not experience at all. So far I have my app installed in an iPhone. When I start it connected to the mac (by usb) it starts fine and all (it appears a kind of a logging message in green at the top of the screen).
However, when the phone is disconnected from the mac, the app doesn't start well, it gets freezed on the 'Powered by react' screen. I wonder if this is a common problem I cant get rid of quickly.
Because the app on your Phone is loading the JS Bundle from your Mac.
You can run the app standalone on your phone just if it's build release ( the js bundle is embeded) or you change the setting on your phone to instead of loading JS Bundle from localhost, load it from your Mac's IP. you need to be connected to same Wifi.
I have a localhost website up at localhost:1336. When I run it on my simulator using Xcode, the app does not encounter any problem make a request to the localhost for data. But when I connect my iPhone via USB cable to the mac, and run the app on the iPhone device and makes the request, but then I get an error "Error- Could not connect to the server.".
I also confirmed that they are on the same Wi-Fi and using same IP. On Safari on my iPhone, I went to http://IPNumber:1336 and it was able to access the site via my iPhone. But some reason, through the app, it cannot connect to the server.
Any input or insight on this would be greatly appreciated. Thank you in advance.
the term 'localhost' means the same device, i think you mean a host on your local network? going localhost:1336 means your device is connecting to itself, its the same as going 127.0.0.1:1336. hence why it works on your simulator but not your phone, since your server and simulator are running on the same device
you have to use http://IPNumber:1336 in your app as well
"Localhost" means the same device. If you are not running a HTTP service on your iPhone, you should not use "localhost".
Another point, you are using "http", if your iPhone is running iOS9+, you will need to check whether App Transport Security will be an issue, here is an article on how to do that: http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/
I am creating Rails server for iPhone app.
I want to debug on iPhone device not on iPhone simulator.
So, I connect iPhone to mac book air by USB, and connect to Rails server.
But, iPhone could not connect to Rails server.
Environment
Rails 4.2.3
Server localhost:3000
Xcode 6.4
iPhone iOS 8.4.1
en0 inet 192.168.11.7
As long As I searched, when iPhone device connect to localhost server, the url is http://192.168.11.7:3000/~.
But, mac console show nothing and xcode show "The request timed out." after a while.
If anyone know how to fix the problem, please tell me.
Use the wonderful http://xip.io/
You don't need to install anything - just go to
http://192.168.11.7.xip.io:3000
on your phone.
If you want to use a particular domain name, eg if your app behaves differently depending on domain names or subdomains, you can do eg
http://mydomain.foo.192.168.11.7.xip.io:3000
EDIT: my answer is actually about connecting to your server over the internet rather than a usb cable. I'd recommend that you use the internet rather than the USB option if possible as it's simpler. xip.io will not work if you can't access the internet.
You probably tried that but funny enough, in my case turning my iPhone off and on again actually fixed the issue.
I had the same problem, my app was working fine and all of a sudden it stopped working although nothing had changed. I could access the internet, the browser was accessing the rails app url just fine but my iOS app did not seem to be able to connect to it.
I needed to run my iOS app from Xcode with my local rails server to my device and xip.io was the solution.
Get the ip address of your computer from the wireless network you are connected to and put that into networking.swift like so.
http://11.1.11.100.xip.io:3000
Make sure the rails server is running and your device is connected to the same network as your computer and build the app.
I am doing a Ray Wenderlich tutorial how to make an app like "Instagram". It's my first time setting up a database. I am using Xampp and hosting on my mac.
I CAN get the app to run with the xcode simulator and I can log in and it works with the server. However when I run my iphone device it runs the app but when I go to login through the app it says "Could not connect to server".
What am I missing? I think all my permissions are set to anybody etc... But again I'm totally new to using a database. It seems though that if the simulator can do it the phone should be able to. Also it's not a provisioning problem, that profile is valid and it wouldn't run on my app if it wasn't. I just cant get to the database from the device.
Any help would be awesome!
If the app isn't able to connect to the server, there might be an issue with the server address.
When running on the simulator, you're still on your mac, so something like http://localhost/DATABASE_ALIAS is enough. But when running on a different device, that is no longer true.
To keep things simple, you should make sure the iPhone is connected to same network as your Mac and then replace localhost with either the Mac local IP or its Bonjour address, for instance: http://YOUR_MAC_NAME.local/DATABASE_ALIAS.
To find out the Bonjour address, open System Settings and find the machine name under Sharing. As an example, if it is called "Herbie MacBook", the address would be "Herbie-MacBook.local".