iosiphonexcodelocalhosthotspot

Connecting to localhost via iPhone while connected to a hotspot


I need some help accessing a server that I have running on my mac. So basically my setup consists of mac on which I'm running my server and also using XCode to run the app on an iPhone connected via USB. And then both this iPhone and the mac are on the same WiFi network which is a personal hotspot that I have running on a different iPhone.

I'm trying to access localhost from the iPhone by basically using my mac's IP address and the right port: http://IPADDRESS:PORT/, however this doesn't seem to work. Any ideas as to what may be going on here and potential workarounds or solutions. Connecting to a non-hotspot, traditional WiFi network is not an option at the moment.


Solution

  • This will work if you have it set up correctly; I am doing it right now. Remember that you have to bind the server to 0.0.0.0 — not 127.0.0.1 — if you want to connect from non-localhost IPs. Also check your system firewall.

    If you're still having trouble, Tailscale is another solution that may help — https://tailscale.com