2011-07-02 3 views
2

매우 쉽게 설명 할 수있을 것으로 확신하지만 문제에 대해 머리가 찢어지고 있습니다.ASIHttpRequest 요청 : didReceiveBytes : 예상대로 작동하지 않습니다.

-(void)addRequestWithUrl:(NSURL *)url savePath:(NSString *)path 
    { 
     ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; 
     request.userInfo = [[NSMutableDictionary alloc] initWithObjectsAndKeys:path, @"savePath", nil]; 
     networkQueue.showAccurateProgress = YES; 
     [self.networkQueue addOperation:request]; 
     [self.networkQueue setDownloadProgressDelegate:self]; 
    } 

    -(void)request:(ASIHTTPRequest *)request didReceiveBytes:(long long)bytes 
    { 
     DLog(@"bytes: %llu", bytes); 
    } 

didReceiveBytes가 호출되지 않았습니다. 다운로드 진행 위임을 대기열 대신 각 요청에 설정하면 didReceiveBytes 메서드가 호출되지만 각 요청이 완전히 완료되고 항상 1의 값으로 만 호출됩니다.

제안 사항이 무엇입니까? (iOS btw에서 작업 중)

+0

을 Hursh의 솔루션이 실제로 당신을 위해 일을 했습니까? 왜냐하면 그것은 나를 위해 일하지 않기 때문입니다. –

답변

2

그래, 내가 ASIHTTPRequest 코드를 조사하기 시작할 때까지이 결과를 얻으려면 잠시 시간이 걸렸습니다. 당신이해야 할 모든이 추가된다

request.showAccurateProgress = YES; 

전에 networkQueue.showAccurateProgress = YES; 그렇지 않으면 각 파일의 개별 헤드 정보를 읽지 않고 바이트를 더하기 때문입니다. 그것은 도움이 될 수

+0

이 솔루션은 저에게 효과적이지 않습니다. –

4

:

[request setDidReceiveDataSelector:@selector(request:didReceiveBytes:)]; 
관련 문제