借助alamofire进行比较和快速部署

编程入门 行业动态 更新时间:2024-10-11 23:21:17
本文介绍了借助alamofire进行比较和快速部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用alamofire从已部署的API查询数据。如何在请求中进行比较。我有类似的东西:

I am trying to query data from my Deployd API with alamofire. How is it possible to do a comparison in a request. I have something like:

let parameters = ["number": ["gt": 3]] Manager.sharedInstance.request(.GET, "localhost:2403/collections", parameters: parameters).responseJSON { (request, response, result) -> Void in print(result.isSuccess) print(result.data) }

但是结果为空。在我的仪表板中,我有一个数字列,其值分别为:1、2、3和4。因此,响应应向我返回数字为4的行。

But the result is empty. In my dashboard i have a number column with the values: 1,2,3 and 4. So the response should return me the rows with the number 4.

任何想法? 谢谢

Any ideas? Thank

推荐答案

您需要提取值 数据。在Alamofire 2.0中,数据仅在 .Failure 情况下可用。所有这些都已在Alamofire 3.0中进行了重新设计,它利用了 Response 对象。

You need to extract the value instead of the data. In Alamofire 2.0, the data is only available in a .Failure case. This has all been redesigned in Alamofire 3.0 which leverages a Response object instead.

let parameters = ["number": ["gt": 3]] let URLString = "localhost:2403/collections" Manager.sharedInstance.request(.GET, URLString, parameters: parameters) .responseJSON { (request, response, result) -> Void in print(result.isSuccess) print(result.data) print("JSON: \(result.value)") print("Error: \(result.error)") }

更多推荐

借助alamofire进行比较和快速部署

本文发布于:2023-11-26 02:16:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1632249.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:快速   alamofire

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!