我正在从亚马逊s3下载图像的iOS应用程序。我试图跟踪图片下载的进度。亚马逊s3 ios下载进度条
我不能让-(void)request:(AmazonServiceRequest *)request didSendData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite
委托方法触发。
这是我至今设置委托方法的代码。
-(void) viewDidLoad
{
self.s3 = [[AmazonS3Client alloc] initWithAccessKey:ACCESS_KEY_ID withSecretKey:SECRET_KEY];
self.s3.endpoint = [AmazonEndpoints s3Endpoint:US_WEST_2];
NSString *key = [[NSString alloc] initWithFormat:@"path1/%@", uniqueID];
S3GetObjectRequest *downloadRequest = [[S3GetObjectRequest alloc] initWithKey:key withBucket: PICTURE_BUCKET];
[downloadRequest setDelegate:self];
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.labelText = @"Loading Picture...";
S3GetObjectResponse *downloadResponse = [s3 getObject:downloadRequest];
}
-(void)request:(AmazonServiceRequest *)request didSendData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite
{
NSLog(@"Bytes Written: %i", bytesWritten);
NSLog(@"Total Bytes Written: %i", totalBytesWritten);
NSLog(@"Total Bytes Expected to Write: %i", totalBytesExpectedToWrite);
}
我设法让这个委托方法工作上传图像,但似乎无法让它下载工作。为了追踪下载进度,我需要做什么不同的事情?
感谢
希望这个链接将帮助你! http://docs.aws.amazon.com/mobile/sdkforios/developerguide/s3transfermanager.html#track-progress – arunjos007