Closed Corgizzz closed 2 years ago
Hi @Corgizzz,
You are correct, the task won't report an error until the timeoutIntervalForResource
expires. Behind the scenes, TransferUtility starts the transfer with an NSURLSession configured for background operation, and that task will automatically retry up to the configured timeout, so you won't see any failure notifications in the meantime.
Hope this helps.
Hi @palpatim ,
I try add timeoutIntervalForResource
and retryLimit
but I still not receieve any error,
Will this issue be fixed in the future ? or Now is the final usecase , Thanks
Regards
What values did you set each of those properties to?
I set timeoutIntervalForResource = 20, retryLimit = 3
We will need to investigate this further then. We've validated this behavior in the past, but perhaps there's something about a network connectivity loss that causes it to behave differently.
Wait for good news , Thanks ~
When network connectivity is lost during upload, I confirmed that the completionHandler is called with an error as expected after timeoutIntervalForResource expires. However, it's important to note that timeoutIntervalForResource must be configured prior to instantiating the service client.
For example, you could create a customized AWSS3TransferUtility with something like the following:
// Create customized AWSS3TransferUtility if it doesn't already exist
if AWSS3TransferUtility.s3TransferUtility(forKey: "customTU") == nil {
// Set custom options
let tuConfig = AWSS3TransferUtilityConfiguration()
tuConfig.timeoutIntervalForResource = 60
// Read default service info from awsconfiguration.json
guard let tuInfo = AWSInfo.default().defaultServiceInfo("S3TransferUtility"),
let serviceConfig = AWSServiceConfiguration(region: tuInfo.region,
credentialsProvider: tuInfo.cognitoCredentialsProvider)
else {
print("Failed to create service configuration from settings in awsconfiguration.json.")
return
}
// Register customized AWSS3TransferUtility
AWSS3TransferUtility.register(with: serviceConfig,
transferUtilityConfiguration: tuConfig,
forKey: "customTU")
{ error in
if let error = error {
print("Error registering TransferUtility: \(error.localizedDescription)")
return
}
}
}
And then retrieve it like this:
guard let transferUtility = AWSS3TransferUtility.s3TransferUtility(forKey: "customTU") else {
print("Failed to get custom instance of AWSS3TransferUtility")
return
}
In this example, the completion handler will be called with a timeout error if the upload does not complete within 60 seconds.
Hope this helps.
State your question
I am using TransferUtility to upload my data to S3, When task in progressing I put my phone on airplane mode or close network , The task will be pause but I didn't get any error message or handler, I know that network become connection the task will automatically upload again, Is there any error response to tell me the task is paused ?
Which AWS Services are you utilizing? S3 Transfer Utility
Provide code snippets
Environment :
Device Information :
In My Xcode Debug Console :