0
Я использую этот простой запрос HTTP, чтобы загрузить файл с s3 сервера:распознать, если файл существует с ASIHttprequest от амазонки s3
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDidFinishSelector:@selector(done:)];
[request setDownloadDestinationPath:dest];
[request setDownloadProgressDelegate:pv];
[request setDelegate:self];
[request setShowAccurateProgress:YES];
[request setShouldContinueWhenAppEntersBackground:YES];
[request startAsynchronous];
pv.hidden = NO;
[request setFailedBlock:^(void) {
NSLog(@"Download failed: %@. reason:%@", url, [request.error localizedDescription]);
}];
[request setCompletionBlock:^(void){
NSString *zipFilePath = dest;
[SSZipArchive unzipFileAtPath:zipFilePath toDestination:desti];
NSFileManager *fileManager = [NSFileManager defaultManager];
[fileManager removeItemAtPath:zipFilePath error:NULL];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"ההורדה הסתיימה" message:@"מה ברצונך לעשות" delegate:self cancelButtonTitle:@"חזרה לתפריט" otherButtonTitles:@"נגן אפליקציה",nil];
[alert show];
}];
загрузка работает хорошо, но проблема в том, что запрос всегда удается, его не удалось также, если в URL-адресе запроса нет существующего файла.