如何停止/取消AWS S3下载请求 [英] How to stop/cancel the download request in aws s3

查看:583
本文介绍了如何停止/取消AWS S3下载请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下载来自Amazon 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];

这是在code段是用下载了。

This is the code snippet am using for download.

推荐答案

S3GetObjectRequest 有一个叫做财产<一个href="http://docs.aws.amazon.com/AWSiOSSDK/latest/Classes/AmazonServiceRequest.html#//api/name/urlConnection"相对=nofollow> URLConnection的。您可以拨打取消的URLConnection 属性取消下载请求。

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

这篇关于如何停止/取消AWS S3下载请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆