Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing local server with iOS 9.2 and Xcode 7.2 using localhost

Tags:

ios

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.

like image 863
djserva Avatar asked May 13 '26 15:05

djserva


1 Answers

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.

like image 172
rckoenes Avatar answered May 16 '26 05:05

rckoenes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!