我使用Swift-SRWebClient在单个帖子中上传多个图像但是我无法使用swift 2.2这样做?使用REST API

时间:2016-10-26 12:15:09

标签: swift

这是我的代码:

SRWebClient.POST("http://www.tiikoni.com/tis/upload/upload.php").data(messageData, fieldName:"photo", data: ["CreatedBy":"4","Name": "Test", "Description" :"Test","CategoryId": "0", "SendToSupplier":"0","DeliveryDate":"25/10/2016","FileExtension":"png"])
        .send({(response:AnyObject!, status:Int) -> Void in
            // process success response
            },failure:{(error:NSError!) -> Void in
                // process failure response
        })

这个方法给我错误

  

无法使用类型为.....的参数列表调用

1 个答案:

答案 0 :(得分:0)

SRWebClient.POST("YOUR URL/M/API").data(YorARRAYOFIMAGEDATA,
                                        fieldName:"photo",
                                        data: [
                                            "CreatedBy":"4",
                                            "Name": "Test",
                                            "Description" :"Test",
                                            "CategoryId": "0",
                                            "Parameters":"0",
                                            "DeliveryDate":"25/10/2016",
                                            "FileExtens‌​ion":"png"
    ])
    .send({(response:AnyObject!, status:Int) -> Void in
        print("Success")
        self.navigationController?.popFadeToRootViewController()
    }, failure: {(error:NSError!) -> Void in
        print("failure")
    }
)