Search code examples
objective-cxcodexcode4amazon-web-servicesamazon-s3

How to stop/cancel the download request in aws s3


While downloading files from amazon s3, I have tried to cancel/stop the file . But i cant get any solutions. So kindly suggest me a solution. Thanks

S3GetObjectRequest *downloadRequest = [[[S3GetObjectRequest alloc] initWithKey:path withBucket:SECRET] autorelease];
    downloadRequest.delegate=self;
    [s3 getObject:downloadRequest];
    NSData *myData2;
        myData2 = response.body;
        [myData2 writeToFile:filePath atomically:YES];

This is the code snippet am using for download.


Solution

  • S3GetObjectRequest has a property called urlConnection. You can call cancel on the urlConnection property to cancel your download request.