So, I have detached my app to use bluetooth and everthing works on android but it’s a mess on iOS.
First thing: I’m using a VM to run OSX and exp start, the project build well, but when it launch on the device I’ve got:
“Error while loading: Could not connect to the server” code 1004.
Plus, the packager ip looks like <exp random numbers>://localhost:19000
How to change the “localhost” part? The device doesn’t ask for ip or anything, tried to change IP in EXBuildConstants.plist but the value is rewrite everytime I build with Xcode. I can’t change any IP in AppDelegate.m (or I don’t know where to change it)
Btw, I can access my packager data from outside the VM, so the network is well configured.
Thanks
Hi, the exp<random numbers> scheme is deliberate. It’s how XDE/exp know which app to open on your device/simulator (since you aren’t using Expo Client any more).
You can change the type of url to something besides localhost the same way you would prior to detaching, by clicking the gear menu in XDE or using a flag on exp start when serving your project.
Thanks, but it’s seems I have miss explained my problem.
The packager works fine and give me exp<random numbers>://192.168.11.82:19000 , nothing wrong here.
But when I build my app from xcode on my device, I’ve got an error in app : “Error while loading: Could not connect to the server” code 1004.
The built app tries to load exp <random numbers>://localhost:19000 when the packager serve the code on <exp random numbers>://192.168.11.82:19000
The value in EXBuildConstants.plist is written by the “Prepare ExpoKit” build phase in your detached Xcode project. It runs a script to ping your local packager and asks what url it should load, then writes that url to EXBuildConstants so that the iOS app can hit this at runtime.
Sounds like either something’s causing the build hook to retrieve the wrong url, or something’s up with your local network. What happens if you restart your packager to specifically serve a localhost url instead of a LAN ip?
Seems like exp start --host localhost is working with simulator but I can’t test on device atm. Saldy I’m not sure it will work since the app ping for the localhost url.
Seem same problem. I build the detach app with xcode and exp start in the same machine.
Normally, the app build will fill the real ip of the machine in EXBuildConstants.plist, but now it is always override the ip with “localhost”. Result, the app can’t connect to the machine.