Simulator refuses to connect to *.local. hostname

I am working on an iOS app that connects to a web service. For development and testing, we use Bonjour to find servers on the local network, and during sign-in the app offers to connect to one of them instead of the production site.

Since upgrading to Xcode 7 on El Capitan, I am unable to connect from the Simulator to a web server running on the same Mac. I am able to reproduce this issue using Simulated Mobile Safari and the web server that comes with the stock Python in OS X.


  1. Open Terminal, start a web server: python -m SimpleHTTPServer 8000
  2. Open Safari inside the Simulator, enter URL: http://my-computer-name.local.:8000/


Simulated Mobile Safari displays "Safari cannot open the page because it could not connect to the server."


Additionally, the following message appears in the Console each time I try to load the URL:


assertiond[____]: assertion failed: 15A284 13A340: assertiond + 13207 [28CC4371-F3F9-3578-9436-310B23A2C638]: 0x1

Other possibly relevant facts:

  • Desktop Safari is able to connect using the URL http://my-computer-name.local.:8000/
  • Real Mobile Safari (on an iOS device on the same network) is able to connect using the URL http://my-computer-name.local.:8000/
  • Simulated Mobile Safari is able to connect using the URL http://127.0.0.1:8000/ (I need it to work with the Bonjour provided hostname, though).
  • Simulated Mobile Safari is able to connect to another machine with an URL like http://other-computer.local.:8000/
  • I'm using Simulator Version 9.0 (SimulatorApp-620 CoreSimulator-179)
  • Searching the web for the UUID 28CC4371-F3F9-3578-9436-310B23A2C638 yields only a handful of job posts.
  • This does not appear to be related to App Transport Security. My app behaves this way when ATS is disabled.


Are you able to reproduce this problem? Am I missing something?

Filed rdar://22999127 regarding this issue.

Hi, Ben. ;-)


I can confirm this. I'm going through an older app, making changes to debug on Xcode 7.1 and iOS 9, and in the process of figuring out the correct way to add an exception for ATS in development mode (where I can't easily use HTTPS), I've found that the simulator is unable to connect to the local Mac in surprising ways.


I'm using the .local ATS exception described by Quinn in another thread, but a request to that .local address is unable to connect. When checking by hand through Safari in the simulator, I tried a bunch of different things that all should reach the same development server.


http://localhost:3000/ - works

http://127.0.0.1:3000/ - works

http://steves-mac-pro.local:3000/ - fails

http://macpro:3000/ - fails

http://192.168.1.12:3000/ - fails


The middle one resolves via Bonjour, and I can telnet to it from a terminal (though it fails on two IPv6 addresses before succeeding with an IPv4 address). macpro will resolve in the default DNS domain to the last one. All of these work from desktop Safari.

I'm seeing the same issue with Simulator 9.1 under El Capitain. In my case, I'm trying to access a fully-qualified domain name that's set up for my machine on our internal DNS server. My machine is running the built-in Apache install.


http://localhost - works in 9.1 Simulator Safari

http://my.fqdn.ca - fails in 9.1 Simulator Safari returns "Safari cannot open the page because the server cannot be found"

Both addresses work fine in 8.4 Simulator Safari


http://my.fqdn.ca worked in 9.1 Simulator under OS X 10.10. The upgrade to 10.11 is what broke it.

I belive I'm experiencing a similar problem. I use the iOS simulator to test websites powered by a local Mamp server. In 8.4 I could connect to my local domain (whatever.mydomain.com) just fine. However in the latest version of the similator it returns "Safari cannot open the page because the server cannot be found."


I guess I'm off to see if I can somehow downgrade XCode on this machine. 😟

It has nothing to do with Xcode. This is a bug in the iOS Simulator runtime. You should just use the workaround that has been given, or if you really want to run your app in the older iOS runtime, just download the runtime from Xcode's Preferences. There's no need to install an older version of Xcode just for this.

Simulator refuses to connect to *.local. hostname
 
 
Q