Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Simulator NSPOSIXErrorDomain Code=2 after upgrading to OSX El Capitan

After I upgraded from Yosemite to El Capitan, my simulator can no longer connect to my local server. The same simulator has no problems connecting to my remote production server.

I'm sure my local server is running fine as Safari can connect to it properly using the same port.

Here's the error I'm getting in Xcode:

Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={NSErrorFailingURLStringKey=http://localhost:9000/sites, NSErrorFailingURLKey=http://localhost:9000/site, _kCFStreamErrorCodeKey=2, _kCFStreamErrorDomainKey=1}

I'm running xcode 7.0.1 Simulator iOS 9.0

like image 865
Jay Q. Avatar asked Oct 03 '15 01:10

Jay Q.


4 Answers

This is a known bug according to the Xcode 7.1 beta 3 release notes: "When running in the iOS simulator, an app cannot communicate with TCP/IP services locally hosted by the Mac. (22453539)"

like image 79
Moe Salih Avatar answered Oct 11 '22 00:10

Moe Salih


Looks like this problem persists only on simulator while real device work as expected

like image 32
Aleksey Mazurenko Avatar answered Oct 11 '22 01:10

Aleksey Mazurenko


Problem was fixed after upgrading to 7.2.

like image 2
Jay Q. Avatar answered Oct 11 '22 01:10

Jay Q.


Using Charles can solve this problem miraculously. Just keep Charles opened, and the problem will go away.

like image 1
Hai Feng Kao Avatar answered Oct 11 '22 00:10

Hai Feng Kao