djserva
djserva

Reputation: 395

Accessing local server with iOS 9.2 and Xcode 7.2 using localhost

I just upgrade to iOS 9.2 and Xcode 7.2 and now my app can't access the local API server debugging in the device using http://localhost (on simulator it works like a charm). I changed the address to my local network IP (192.168.0.3) and it worked but I'd like to know if there is some setting or something like that to work with localhost again.

Upvotes: 3

Views: 1804

Answers (2)

NadZ
NadZ

Reputation: 1054

This could be a network issue, suppose, if your device and your mac (xcode running) is not in the same wireless network, I had the same problem, my device was not connecting on my 4G network, whereas my computer was on my wireless network.

Upvotes: -1

rckoenes
rckoenes

Reputation: 69459

And this should not work, localhost is the device it self not your machine which is running you API server.

It work on the simulator because it is running on the machine, so localhost will resolve to the same machine.

You should use either your public IP or host name from your device.

Upvotes: 3

Related Questions