iOS AWS S3上载如何重试失败或出现故障的任务?
我正在使用iOS AWS SDK的批量上传iOS AWS S3上载如何重试失败或出现故障的任务?,ios,amazon-s3,aws-sdk,amazon-cognito,awss3transfermanager,Ios,Amazon S3,Aws Sdk,Amazon Cognito,Awss3transfermanager,我正在使用iOS AWS SDK的批量上传[AWSTask task for completionof all tasks:tasks]该tasks数组是AWSTask*task=[self.transferManager upload:uploadRequest]的数组对象。上传完成后,我可以枚举整个数组,检查所有任务是否成功。然而,我似乎不知道如何重试失败或出错的任务。如果我将一组失败的任务传递给task以完成所有任务它对这些任务没有任何作用 它没有提到任何关于重试失败或出错的任务的内容。是
[AWSTask task for completionof all tasks:tasks]
该tasks
数组是AWSTask*task=[self.transferManager upload:uploadRequest]的数组代码>对象。上传完成后,我可以枚举整个数组,检查所有任务是否成功。然而,我似乎不知道如何重试失败或出错的任务。如果我将一组失败的任务传递给task以完成所有任务
它对这些任务没有任何作用
它没有提到任何关于重试失败或出错的任务的内容。是的,存在AWSServiceConfiguration.maxRetryCount
,但这并不能解决在超过该计数后重试故障或失败任务的问题。此外,也没有显示任何与此相关的内容
- (void)performS3UploadWithRequest:(NSArray *)tasks withRetryCount:(int)retryCount
{
if (retryCount == 0) {
alert = [[UIAlertView alloc] initWithTitle:@"Failed to Upload Content"
message:@"It appears we are having issues uploading your card information."
delegate:self cancelButtonTitle:nil
otherButtonTitles:@"Retry Upload", @"Retry Later", @"Cancel Order", nil];
[alert show];
} else {
[[AWSTask taskForCompletionOfAllTasks:tasks] continueWithExecutor:[AWSExecutor mainThreadExecutor] withBlock:^id(AWSTask *task) {
NSMutableArray *faultedTasks = [NSMutableArray new];
for (AWSTask *finishedTask in tasks) {
if (finishedTask.cancelled || finishedTask.faulted) {
[faultedTasks addObject:finishedTask];
}
}
if (faultedTasks.count > 0) {
[self performS3UploadWithRequest:faultedTasks withRetryCount:retryCount-1];
} else {
[[NSNotificationCenter defaultCenter] postNotificationName:kWHNotificationUploadDone object:self userInfo:nil];
}
return nil;
}];
}
}
您需要重新创建任务对象并重新初始化任务。e、 g.再次调用-上传:
。是否有办法从出现故障或失败的任务中提取数据(密钥、存储桶、正文)?如果必须尝试单独跟踪这些数据,然后在任务失败时尝试从这些数据创建一个全新的任务,这将是非常麻烦的。假设我正在批量上传100个文件,一个任务失败或出现故障,而你说我不能简单地重试那个失败的任务。所以,我需要找出那个出错的任务包含的文件,然后用这些数据创建一个全新的任务。