借助alamofire进行比较和快速部署 [英] Deployd comparison and swift with alamofire

查看:86
本文介绍了借助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, "http://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 = "http://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进行比较和快速部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆