aws-sdk-ios
aws-sdk-ios copied to clipboard
Cache files left when AWSS3TransferUtilityMultiPartUploadTask canceled
Describe the bug After [AWSS3TransferUtilityMultiPartUploadTask cancel] calling of big file such as 60MB, there are cache files left in /Library/Caches/S3TransferUtility. If [S3TransferUtility uploadFileUsingMultiPart:...] -> [task cancel] all the time, there would be bad for iPhone' storage.
To Reproduce Steps to reproduce the behavior:
- Call [S3TransferUtility uploadFileUsingMultiPart:...]
- Call [AWSS3TransferUtilityMultiPartUploadTask cancel]
- Go to (App)/Library/Caches/S3TransferUtility
- See the left cache files
Which AWS service(s) are affected? S3
Expected behavior A clear and concise description of what you expected to happen. Cache files should be deleted.
Environment(please complete the following information):
- SDK Version: [2.9.8 and 2.8.2]
- Dependency Manager: [Cocoapods]
- Objective-C
Device Information (please complete the following information):
- Device: [iPhoneXR, Simulator]
- iOS Version: [iOS 12.1]
Hi @SGA-ou-enhaku ,
Thanks for bringing this to our attention. This would be an agreeable improvement to the current behavior. We will look into prioritizing this item. In the meantime, we are open to pull requests if you are interested.
I'm also having this. Please how could we remove the cache?
this code solved my issue, I run this everytime something is correctly uploaded
func cleanCache(){
if let url = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first {
let urls = try? FileManager.default.contentsOfDirectory(at: url, includingPropertiesForKeys: nil, options: .skipsSubdirectoryDescendants)
urls?.filter { $0.lastPathComponent.contains("S3") }.forEach { try? FileManager.default.removeItem(at: $0) }
}
}
yes,you can call suspend and it will pause,no remove cache