SRWebClient图像上传无法转换值

时间:2017-01-25 10:37:30

标签: swift

我开始使用ios并将我的项目转换为Swift 3后我收到此错误消息

  

无法转换类型'(AnyObject!,Int)的值 - >虚空'预期参数类型' SRWebClient.SuccessHandler?'

我无法弄清楚出了什么问题,我该如何解决这个问题?

if(image != nil) {
    let imageData: Data = UIImagePNGRepresentation(image!)!
    SRWebClient.POST(url)
        .data (imageData, fieldName:fieldName, data: d)
        .send({(response:AnyObject!, status:Int) -> Void in // Error message here
            //process success response
            (self.delegate?.ApiCallCompleted!(response as! NSDictionary, error: nil))!;
            },failure:{(error:NSError!) -> Void in
                //process failure response
                self.delegate?.ApiCallCompleted!(["":""], error: error);
            })
}

提前致谢!

1 个答案:

答案 0 :(得分:1)

SuccessHandler表达式语法为public typealias SuccessHandler = (Any?, Int) -> Void

将此表达式(response:AnyObject!, status:Int) -> Void in更改为(response: Any, status:Int) -> Void in

了解更多支票SRWebClient