我試圖上傳圖片到我的網絡服務器時收到此錯誤。我剛剛複製並粘貼了github上的alamofire樣本,我馬上收到一個錯誤消息。我的代碼如下:模糊引用會員上傳alamofire
let data = UIImageJPEGRepresentation(picOutlet.image, 0.5)
Alamofire.upload(.POST, "phpurlhere", file: photo)
.progress { bytesWritten, totalBytesWritten, totalBytesExpectedToWrite in
print(totalBytesWritten)
// This closure is NOT called on the main queue for performance
// reasons. To update your ui, dispatch to the main queue.
dispatch_async(dispatch_get_main_queue()) {
print("Total bytes written on main queue: \(totalBytesWritten)")
}
}
.validate()
.responseJSON { response in
debugPrint(response)
}
更新:我添加JPEG表示要傳遞給alamofire功能,但仍然得到同樣的錯誤。
你收到了什麼錯誤? – pableiros
模糊引用成員上傳(_:_:headers:file :)' – Martheli
你爲什麼在url參數上使用'phpurlhere'而不是url? – pableiros