Updating code base to Swift 3. Was testing uploading images and videos and found an unusual use bug. Alamofire is updated and current on pod version "4.3.0".
Some images upload to s3 just fine, while others are only uploading around 104kb out of what is usually around 3 to 4mb worth of data. Video uploads work without any issues. All uploads use the same code path.
There are no errors thrown. The uploads in question show up as a black box.
Has anyone seen anything similar since updating? Is there a syntax change that I missed after looking at the updated Alamofire readme? Any ideas or feedback on possible causes is greatly appreciated!
The upload logic in question:
let uploadToken = UploadToken(dictionary: result)
Alamofire.upload(multipartFormData: { (multipartFormData) in
for (key, data) in uploadToken.s3Policy {
if let encodedData = (data as! String).data(using: .utf8) {
multipartFormData.append(encodedData, withName: key)
}
}
multipartFormData.append(url, withName: "file")
}, to: uploadToken.urlString, encodingCompletion: { (result) in
switch (result) {
case .failure(let error):
completionHandler(nil, .uploadFailed(error as NSError))
case .success(let request, _, _):
request.uploadProgress(closure: { (progress) in
let percentComplete = (progress.fractionCompleted * 0.9) + 0.1
progressHandler(Float(percentComplete))
})
request.validate().response(completionHandler: { (_) in
completionHandler(uploadToken.id, nil)
})
}
})