[英]Alamofire requests are slow
I'm using Alamofire in my project, my problem is requests takes a long while to load (10 seconds at least), is there a way to speed it up? 我在项目中使用Alamofire,我的问题是请求加载需要很长的时间(至少10秒),是否可以加快速度? That's one of the requests I'm handling 那是我要处理的要求之一
override func viewDidLoad() {
super.viewDidLoad()
Alamofire.request(.GET, TripsEndPointURL, parameters: nil)
.responseJSON { (request, response, JSONData, error) in
if (error != nil) {
NSLog("Error: \(error)")
}
else {
TripsTableList = JSON(JSONData!)
self.TripsTableView.reloadData()
}
}
}
You're using Alamofire correctly. 您正在正确使用Alamofire。 I'd imagine this is a problem with the server, or your connection. 我以为这是服务器或您的连接出现问题。 Try replacing the endpoint URL with the url of any small image, from a different server, just to experiment with downloading it. 尝试用另一台服务器上的任何小图像的URL替换端点URL,以尝试下载它。 If it's still slow, it's your connection. 如果仍然很慢,那就是您的连接。 If it's faster, it's the server. 如果速度更快,那就是服务器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.