我正在开发应用,将短视频上传到Amazon S3(大约5Mb)。但有时(约1次上传5次)会长时间挂起(约1分钟),然后从头开始上传并完成上传。有时在1次上传期间会发生两次。从调试输出我发现,Code = -1001“请求超时”。发生了,然后S3 SDK以静默方式重启请求。
下一步上传代码:
request = [[AWSS3TransferManagerUploadRequest alloc] init]; // request is strong ref
request.bucket = kS3BucketName;
request.key = s3VideoKey;
request.body = videoFileUrl;
request.ACL = AWSS3BucketCannedACLPublicRead;
request.uploadProgress = ^ (int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend) {
NSLog(@"Progress: %lld", totalBytesSent);
};
AWSS3TransferManager *transferManager = [AWSS3TransferManager defaultS3TransferManager];
task = [transferManager upload:request]; // task is strong ref
[task continueWithExecutor:[AWSExecutor mainThreadExecutor] withBlock: ^id (AWSTask *task) {
if (task.error != nil) {
NSLog(@"Error %@", task.error);
}
else {
NSLog(@"download completed");
}
[self requestIsFinished];
return nil;
}];
在此处发现了类似问题:Amazon S3 video upload issue for the iOS SDK v2并提出了“请求”和“任务”强引用,但它没有帮助。
有人遇到同样的问题吗?
由于