URLSession DNS failure

Specifically, when using URLSession.dataTask:..., I get this error:

dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:7 Err:-1 Errno:1 Operation not permitted
[] nw_resolver_create_dns_service_on_queue DNSServiceCreateConnection failed: ServiceNotRunning(-65563)
Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={NSUnderlyingError=0x60800005bae0 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_kCFStreamErrorCodeKey=-72000, _kCFStreamErrorDomainKey=10}}, NSErrorFailingURLStringKey=https://<URL snipped>, NSErrorFailingURLKey=https://<URL snipped>, _kCFStreamErrorDomainKey=10, _kCFStreamErrorCodeKey=-72000, NSLocalizedDescription=A server with the specified hostname could not be found.}


This error only occurs in my Xcode project, and not anywhere else in my system (e.g. Safari), so I don't think this is a problem with my DNS setup (I did try changing DNS addresses to make sure). The URL I'm requesting works in other applications, so it isn't a server problem either.

I don't observe any UDP/TCP traffic using Wireshark when URLSession.dataTask: runs.

Does anyone have any thoughts as to what the issue is?


Xcode 8.1

10.12.2 Beta (16C41b)


Thanks

Answered by Gofake1 in 199442022

The problem turned out to be trivial: I enabled App Sandbox but didn't check Outgoing Connections.

Accepted Answer

The problem turned out to be trivial: I enabled App Sandbox but didn't check Outgoing Connections.

Thank you

Thank you.

Strange that iCloud works without this enabled.

URLSession DNS failure
 
 
Q