0
我對swift和iOS的東西很陌生。我跑到這個錯誤,我不知道如何解決它。我的猜測是,constructingBodyWithBlock有一個無效的說法,但我不知道如何使它有效無法找到接受提供參數的'POST'超載
這裏是我的代碼:
class func sendEmail(
sendGridUrl: String,
params: Dictionary<String, String>,
fileData: NSData,
name: String,
fileName: String,
mimeType: String,
successCallback: (object: Dictionary<String, AnyObject>) -> Void,
errorCallback: (statusCode: Int) -> Void) {
let manager = AFHTTPRequestOperationManager()
let url = sendGridUrl
manager.POST(url, parameters: params, constructingBodyWithBlock: { (formdata: AFMultipartFormData) in
formdata.appendPartWithFileData(fileData, name: name, fileName: fileName, mimeType: mimeType)
}, success: { (operation: AFHTTPRequestOperation!, responseObject: AnyObject!) in
successCallback(object: responseObject as Dictionary<String, AnyObject>)
}, failure: { (operation: AFHTTPRequestOperation!, error: NSError!) in
errorCallback(statusCode: error.code)
})
}