【发布时间】:2018-06-14 14:43:20
【问题描述】:
我正在使用 swiftHTTP 向我的服务器请求,当我的互联网连接速度很慢时,它会转到响应部分!我在下面设置了示例代码:
HTTP.GET("myURL") { response in
let myResponse = response.data // it comes here after the timeout
if response.statusCode == 200 {
//some code
} else {
do {
let jsonError = try JSON(data: myResponse) // in this line it goes to catch because there is no data in myresponse
} catch{
//alert for not having connection
}
}
如果没有响应,为什么会调用响应函数?
我的服务器也说,没有发送请求。
【问题讨论】:
标签: ios swift httprequest