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


本文版權歸本人和博客園所有,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM