您的位置:首页 > 移动开发 > IOS开发

【iOS系列】-A server with the specified hostname could not be found.问题解决

2016-01-04 19:22 1141 查看

【iOS系列】-A server with the specified hostname could not be found.问题解决

Reveal 在iOS开发中可以方便查看界面的布局,较为方便的能够查出view(等)不出现,或者遮挡等,节约大批的时间。

但是今天Reveal出现了问题:
A server with the specified hostname could not be found.


截图如下:



Google了一下发现了一片文章也许道出了问题的真相。

参考文档

里面有一句话

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

所以也就是hosts文件损坏了,那么就查看hosts文件,在终端中执行:(不是vim党,所以习惯用open指令,系统会调用编辑器进行打开)

open /etc/hosts

出现

# SwitchHosts!
# My Hosts

发现原来hosts真的已经窜改了。Reveal好像需要用到
127.0.0.1
这个端口的。

所以就把hosts文件改回来,如下(怎样改后面有介绍):

# 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

想了一下,才发现是前几天修改了hosts文件,导致的。用的工具是:SwitchHosts! 一款集管理、切换 N 个 Hosts 方案的开源软件。

SwitchHosts下载页面 - 可选择最新版的进行下载

注:hosts文件直接修改是无效的,想着用管理员权限执行
su /etc/hosts
,但是总是返回
su: Sorry
,但是我有SwitchHosts直接就可以修改了,所以也就没有关注这个权限的问题

hosts文件的修改界面



保存后,再次打开Reveal发现可以使用了。

欢迎您的访问...

作者:Darren

微博:@IT_攻城师

github:@Darren90

博客:http://www.cnblogs.com/fengtengfei/

本文版权归本人和博客园所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: