Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone connection to localhost rails sarver

I am creating Rails server for iPhone app. I want to debug on iPhone device not on iPhone simulator. So, I connect iPhone to mac book air by USB, and connect to Rails server. But, iPhone could not connect to Rails server.

Environment
Rails 4.2.3
Server localhost:3000
Xcode 6.4
iPhone iOS 8.4.1
en0 inet 192.168.11.7

As long As I searched, when iPhone device connect to localhost server, the url is http://192.168.11.7:3000/~. But, mac console show nothing and xcode show "The request timed out." after a while.

If anyone know how to fix the problem, please tell me.

like image 395
penlight Avatar asked Dec 05 '25 03:12

penlight


1 Answers

Use the wonderful http://xip.io/

You don't need to install anything - just go to

http://192.168.11.7.xip.io:3000

on your phone.

If you want to use a particular domain name, eg if your app behaves differently depending on domain names or subdomains, you can do eg

http://mydomain.foo.192.168.11.7.xip.io:3000

EDIT: my answer is actually about connecting to your server over the internet rather than a usb cable. I'd recommend that you use the internet rather than the USB option if possible as it's simpler. xip.io will not work if you can't access the internet.

like image 91
Max Williams Avatar answered Dec 07 '25 16:12

Max Williams



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!