[IOS series] -A server with the specified hostname could not be found. Problem solved

Reveal can easily view the layout of the interface in iOS development. It is more convenient to find out that the view (etc.) does not appear or is blocked, which saves a lot of time.

But today Reveal has a problem:A server with the specified hostname could not be found.

Screenshot below:

Google took a look and found an article that might tell the truth about the problem.

Reference documents

There is a sentence in it

The real issue was that I had messed up my /etc/hots file and localhost was broken.

So that is, the hosts file is damaged, then check the hosts file and execute it in the terminal: (It is not a vim party, so I am used to using the open command, the system will call the editor to open)

 open /etc/hosts

appear

# SwitchHosts!
# My Hosts

It turns out that the hosts have really been tampered with. Reveal seems to need 127.0.0.1this port.

So change the hosts file back, as follows (how to change is described later):

# SwitchHosts!
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1             localhost 

After thinking about it, I discovered that the hosts file was modified a few days ago. The tool used is: SwitchHosts! An open source software that integrates management and switching N Hosts solutions.

SwitchHosts download page -you can choose the latest version to download

Note: It is invalid to modify the hosts file directly. I want to execute su /etc/hostsit with administrator authority , but it always returns su: Sorry, but I can modify it directly if I have SwitchHosts, so I don’t pay attention to the issue of this authority.

Modify interface of hosts file

After saving, open Reveal again to find it can be used.

Similar Posts: