I am trying to connect to my localhost on my macbook with my phone plugged in. I have an iPhone 5s.
I have tried using:
var url:NSURL = NSURL.URLWithString("http://192.168.0.108/laravel/roadi/public/login")
var url:NSURL = NSURL.URLWithString("http://localhost/laravel/roadi/public/login")
var url:NSURL = NSURL.URLWithString("http://josh.local/laravel/roadi/public/login")
But all give me the error "The request timed out" I have tried deactivating my firewall as well.
What is going wrong, / how can I fix this? The the localhost
and josh.local
work perfectly in the simulator.
On simulator you are running on same machine as Mac, that's why the localhost will work. On iPhone you need to use ip address of your Mac. If you are connected to the same network, you can try to find local address of Mac and use it:
http://www.wikihow.com/Find-Your-IP-Address-on-a-Mac
If you are not connected to the same network, you could try using public ip address, type in google "my ip address". But this may change frequently (if you have dynamic ip address)