ASIHTTPRequest를 사용하여 비동기 다운로드를 취소하려고 시도하고 있습니다. ViewController의 모양으로 디스크에 동영상을 다운로드합니다. 원하는 것은 사용자가 닫기를 클릭하여보기 컨트롤러를 닫고 다운로드를 취소하려는 경우입니다.ASIHTTPRequest 비동기 다운로드 취소하지 않습니다
요청 만들기 : 모든 것이 작동
- (IBAction)closeDocDisplay:(id)sender {
// Cancels an asynchronous request
[ashiRequest clearDelegatesAndCancel];
[self dismissModalViewControllerAnimated:YES];
}
, 다운로드가 미세하고 영화가 제대로 재생하지만 :
-(void)retrieveLatestFile{
NSURL *url = [NSURL URLWithString:[appDelegate.urlToLoad stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
ashiRequest = [[ASIHTTPRequest requestWithURL:url] retain];
[ashiRequest setUsername:@"Appidae"];
[ashiRequest setPassword:@"Dubstance1"];
[ashiRequest setDelegate:self];
[ashiRequest startAsynchronous];
[ashiRequest setDownloadProgressDelegate:progressView];
NSLog(@"Value: %f", [progressView progress]);
if ([progressView progress]==1) {
[self hideInfoPane];
}
//NSLog(@"Max: %f, Value: %f", [myProgressIndicator maxValue],[myProgressIndicator doubleValue]);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *tempPath = [NSString stringWithFormat:@"%@/download/%@/%@", documentsDirectory, appDelegate.languageFolder,appDelegate.filename];
NSLog(@"Path: %@", tempPath);
[ashiRequest setDownloadDestinationPath:tempPath];
}
가 다운로드 취소를 여기 코드는 내가 지금까지 가지고있다 View Controller를 닫을 때 요청이 취소되지 않고 파일이 여전히 다운로드 중입니다 (상태 표시 줄의 네트워크 활동 표시기가 회전 함). ASIHTTP 대리인 오류조차도 호출되지 않습니다.