var parameters = NSDictionary() // or Dictionary<String, AnyObject>()
var error:NSErrorPointer = nil
var request: NSMutableURLRequest =
AFHTTPRequestSerializer().multipartFormRequestWithMethod(
"POST",
URLString: "someUrl",
parameters: parameters,
constructingBodyWithBlock: {
(formData: AFMultipartFormData!) -> Void in
formData.appendPartWithFileData(imageData, name: "file",
fileName: "fromIos", mimeType: "image/jpeg")
}, error: error)
xcode6使用此代码工作正常,xcode7与swift2没有。
它说不能用给定的参数调用multipartFormRequestWithMethod
..
无法使用参数列表调用'multipartFormRequestWithMethod' 类型'(String,URLString:String!,参数:NSDictionary, constructBodyWithBlock:(AFMultipartFormData!) - &gt;无效,错误: NilLiteralConvertible)'
我似乎无法发现错误。