我正在尝试使用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进行比较和快速部署
发布评论