使用服务器用户名和密码快速发布方法

时间:2019-02-21 12:47:46

标签: ios swift web-services alamofire

我正在尝试转换此curl命令(有效的 ):

class test
{
    test: {test: string[]}
}

class so extends test
{
    test = {test: []}
}

迅速。

我已经拥有了,但是我不知道如何传递我的appID和appPassword:

any[]

祝您有美好的一天,并在此先感谢您的答复。

1 个答案:

答案 0 :(得分:0)

首先将数据解析为dictionary,使用.updateValue()函数然后将其解析回params,

var params : [String:String] = ["grant_type":"password",
                                "scope":"read",
                                "format":"json"]

params.updateValue("myPassword", forKey: "grant_type")

如果找不到该密钥,它将使用该值创建一个新密钥。