Alamofire.upload(media_data, to: WATSONCLOUD.API, method: .post, headers: header).responseJSON{
(response) in switch response.result{
case .Success(let JSON):
print("Success with JSON: (JSON)")
callback(success: JSON as? NSDictionary, error: nil)
case .Failure(let error):
callback(success: nil, error: error)
print("Request failed with error: (error)")
}
}
我遇到了这个错误:
模棱两可的引用成员'上传(_:to:method:headers :)'
,我不知道如何解决此方法,但没有成功。
尝试以下方法
Alamofire.request(urlString, method: .post, parameters: ["foo": "bar"],encoding: JSONEncoding.default, headers: nil).responseJSON {
response in
switch response.result {
case .success:
print(response)
break
case .failure(let error):
print(error)
}
}