2

I am trying to connect my test device to my local server -- and while the simulator works fine accessing localhost:8000, I can't seem to connect from the device. This despite the fact that the device and my computer are both connected to the same wifi network.

So far, I have tried to get this to work by going to system prefs -> network -> grabbing the IP address from where it says 'Wi-Fi is connected to myWifiNetwork and has the IP address 10.0.0.52'.

Then, i go to safari on my device and type in http://10.0.0.52:8000. This however, gives me a message about being unable to connect to the server.

I've also tried using the 'name' of my computer (which i grab from System Prefs->Sharing or more simply from the terminal window) and try typing that in on the device's browser like so: http://myMac:8000 That does not work either.

Any ideas?

Thanks

Sean Danzeiser
  • 9,141
  • 12
  • 52
  • 90
  • `localhost` is just that, the local host. When run on the simulator you are connecting to the computer. When you run on an iOS device you are connecting to the iOS device. – rmaddy Jan 31 '14 at 19:57
  • Sure, thats not what I tried though. My issue is that i can't connect to my mac even when using the IP address of the mac. – Sean Danzeiser Jan 31 '14 at 19:59
  • Your question title and 1st paragraph are all about connecting to localhost. BTW - this doesn't appear to be a programming question. This is simply a user-level question about using Safari on an iPhone to connect to another computer on the same network. – rmaddy Jan 31 '14 at 20:01
  • @rmaddy, I think this type of question belongs here on StackOverflow because software engineers need to learn how to develop websites that work on iPhone, and it's best to know how to configure your setup such that a site on a local server is browsable via iPhone. – Ryan Mar 10 '16 at 22:42
  • @SeanDanzeiser: You were adding your port (8000) to your URL, so I'm not sure that this other answer will suit your needs, but it has worked for me for a normal website on port 80 (not specified in the URL): http://stackoverflow.com/a/35906500/470749 – Ryan Mar 10 '16 at 22:43

1 Answers1

0

The way I did this was to use Charles Web Proxy, and map a production URL to localHost:8000.

Charles provides excellent documentation for getting your device up and running for this purpose.

Sean Danzeiser
  • 9,141
  • 12
  • 52
  • 90
  • Hmm.. Proxying has been simple to set up, I still cant get it to intercept localhost requests. When you say map it to a production URL is that something special or just hit the url with the request? – Greg Price Sep 06 '15 at 15:14