5

I want to do a demo of an iPhone optimised WebApp using my MacBook Air with a local server, so I don't have to depend on getting an internet connection or WiFi access from my client.

The Air is running Lion 10.7.2 and the iPhone is on iOS 5.0.1.

When I create a network on the Mac I can join from the iPhone, but when I open "http://my-macbook-air/" in Safari, it doesn't work.

Strangely it doesn't seem to utilize the WiFi, as the indicator never appears (but shows connected in the Settings app).

Possibly related: Why is my iPhone unable to connect to an ad hoc wifi network? (though my question is Apple <-> Apple, so I expected it to work).

5
  • If the Wi-Fi indicator on the iPhone doesn't come it, it's probably not (fully) connected. How do you create the network on the Mac?
    – nohillside
    Dec 8, 2011 at 20:18
  • I create it using "Create Network" from the WiFi indicator.
    – User0812
    Dec 8, 2011 at 21:00
  • I don't get the WiFi connector either that way but can access the web server on the Mac with the IP address of the ad-hoc network. See below for a screenshot.
    – nohillside
    Dec 8, 2011 at 21:07
  • Are you using the built in 'Web Sharing' feature of OS X? If not, what are you using? Jan 8, 2012 at 6:09
  • The URL should be http://my-macbook-air.local. As Jason points out you need to use 'Web Sharing' and be on the same LAN.
    – afragen
    Feb 7, 2012 at 16:30

3 Answers 3

1

It is probably related to resolving the host name.

Try using the IP address of the Mac instead of the name:

enter image description here

4
  • Using the Mac's IP didn't help (obtained from ifconfig). I assume Safari/iOS is not using the WiFi because it offers no internet connection?
    – User0812
    Dec 8, 2011 at 21:01
  • Did you pick the right one? In my case it's en1 in ifconfig, you can also get it from Preferences/Network (see screenshot).
    – nohillside
    Dec 8, 2011 at 21:16
  • Nope, using that IP (which is the same ifconfig gave me), doesn't work either. Tried the built-in apache and my dev server both to no avail.
    – User0812
    Dec 8, 2011 at 21:20
  • This is really frustrating. I tried doing it the other way around, using the Mobile Hotspot, but then I get an indicator bar at the top that will stay there all the time, so whether or not they could connect that way, it's not feasible.
    – User0812
    Dec 9, 2011 at 9:40
0

I followed the steps here: http://egalo.com/2012/05/29/testing-mac-web-site-using-local-hostname-on-mobile-device/

It took about 5 minutes to setup and works really well.

0

Not sure if the firewall rules apply to an ad-hoc network, but I spent days with both the apache server and python's SimpleHTTPServer without being able to connect my iphone up, although i was able to connect the iPhone to a windows box running SimpleHTTPServer. It ended up simply being the MAC OS firewall. Turn it off in System Preference -> Security & Privacy -> Firewall. It blocks incoming connections.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .