【发布时间】:2015-11-05 03:05:14
【问题描述】:
我遇到了一个奇怪的问题,我的 Playground 中的 Alamofire.request(.GET) 语句在 Playground 中延迟一段时间后被执行
设置:我按照以下link 导入 Alamofire 框架以在 xcode 游乐场测试网络请求。
这是我在操场上的代码。当我查看我的网络服务器的日志时,日志会在几乎几分钟的延迟后更新。我已经验证不是导致延迟的日志过程。使用 curl 和浏览器发出相同的 http 请求,我看到日志几乎立即更新。
import UIKit
import Alamofire
Alamofire.request(.GET, "http://localhost:5010/asdf")
.responseJSON { response in
print ("Hello there in playground")
print(response.request) // original URL request
print(response.response) // URL response
print(response.data) // server data
print(response.result) // result of response serialization
if let JSON = response.result.value {
print("JSON: \(JSON)")
}
}
【问题讨论】:
标签: xcode swift alamofire swift-playground