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


    【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/


    本文版权归本人和博客园所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。

  • 相关阅读:
    C++学习 之 程序的组成部分(部分知识笔记)
    debian下重装mysql
    CGI 环境变量
    boost的libboost_system问题
    debian下使用shell脚本时出现了 declare:not found 解决方法
    编译的时候出现"/usr/bin/ld: cannot find -lz
    glibc升级,解决glib版本过低的问题
    ubuntu彩色图形界面
    (转)http://blog.chinaunix.net/uid-8363656-id-2031644.html CGI 编写
    linux安装JSONCPP
  • 原文地址:https://www.cnblogs.com/fengtengfei/p/5100005.html
Copyright © 2020-2023  润新知