简体   繁体   中英

XCode: Invalid host string 'localhost'

I'm getting this error: "Invalid host string: 'localhost'" every time I try to compile code on my laptop. My desktop, however, works just fine.

Both the laptop and the desktop have the exact same hosts file in etc/hosts, that is:

##
# 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
fe80::1%lo0     localhost

I've searched so much around the internet and all of them have the same answer: Your hosts file is named incorrectly. But it's not.

It's named hosts. I have made two copies, hosts.txt and just hosts and neither of them work. This leads me to think it's something in XCode's preferences that's looking for hosts somewhere else.

Can you mention your OS ?

Mostly MAC OS X lion giving this error because Apple remove web sharing from 10.8.x

If your OS is 10.8.x then use this link. http://reviews.cnet.com/8301-13727_7-57481978-263/how-to-enable-web-sharing-in-os-x-mountain-lion/

After implementing this link just restart your system

Enjoy...

I was running against the same problem on a run-time of xcode debug. Are you running gas mask? If so, I was simply under the remote file rather than the local in my settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM