我确信对此有一个非常简单的解释,但我对此事感到抓狂。
-(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 从未被调用过。如果我将下载进度委托(delegate)设置为每个请求而不是队列,则会调用 didReceiveBytes 方法,但仅在每个请求完全完成后调用,并且值始终为 1。
有什么建议吗?这里出了什么问题? (顺便说一句,在 iOS 上工作)
最佳答案
这可能有帮助:
[request setDidReceiveDataSelector:@selector(request:didReceiveBytes:)];
关于ios - ASIHttpRequest请求:didReceiveBytes: not working as expected,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6554347/