XCode 6 Simulator ignores hosts file changes

前端 未结 2 1374
旧时难觅i
旧时难觅i 2020-12-31 12:16

I have a client-server App, in order to test it with Simulator I have a server on a virtual machine and I change mac\'s hosts file (/etc/hosts) so I can get there.

I

2条回答
  •  难免孤独
    2020-12-31 13:02

    Solution:

    Make sure you add each host alias on different line:

    # Wrong!
      127.0.0.1 example.com www.example.com
    
    # Good
      127.0.0.1 example.com
      127.0.0.1 www.example.com
    

    My story:

    I had the same issue with Xcode 6.

    There is a bug or behaviour change in OSX related to /etc/hosts.

    If I add more host aliases on the same line in OSX's /etc/hosts file, iOS simulator gives me the same error. But if I add each host alias on it's own line, iOS simulator works as I expect it to.

提交回复
热议问题