let url = URL(string: "https://soufunapp.3g.fang.com/http/sf2014.jsp?messagename=UserCount&wirelesscode=DD146FD49861797918ADA44B7E201180")
let task = URLSession.shared.dataTask(with: URLRequest(url: url!)) { (data, response, error) in
print("Always fail")
if error != nil {
print(error!)
}
}
task.resume()
NSURLConnection.sendAsynchronousRequest(URLRequest(url: url!), queue: OperationQueue.main) { (response, data, error) in
print("always succeed")
}
错误域= NSURLErrorDomain代码= -1001"请求超时。" UserInfo = {NSUnderlyingError = 0x60000005ccb0 {错误 Domain = kCFErrorDomainCFNetwork Code = -1001"(null)" UserInfo = {_ kCFStreamErrorCodeKey = -2102,_kCFStreamErrorDomainKey = 4}}, NSErrorFailingURLStringKey = https://soufunapp.3g.fang.com/http/sf2014.jsp?messagename=UserCount&wirelesscode=DD146FD49861797918ADA44B7E201180, NSErrorFailingURLKey = https://soufunapp.3g.fang.com/http/sf2014.jsp?messagename=UserCount&wirelesscode=DD146FD49861797918ADA44B7E201180, _kCFStreamErrorDomainKey = 4,_kCFStreamErrorCodeKey = -2102,NSLocalizedDescription =请求超时。}
同样,使用Safari无法打开网址,但Chrome可以获取数据