ios - ASIHttpRequest请求:didReceiveBytes: not working as expected

标签 ios asihttprequest

我确信对此有一个非常简单的解释,但我对此事感到抓狂。

    -(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/

相关文章:

ios - 有没有一种快速扫描 iOS 7 应用程序以获取 iOS 8 API 的方法?

ios - 为什么我的 UIPageViewController 中的页面没有变化?

ios - 使用多个 segues 返回而不是展开是个坏主意吗?

objective-c - ASIHTTPRequest requestFinished 未调用

ios - App Invite 配置失败 Firebase iOS cocoapods

ios - 我们如何在另一个类中的数组或字典数据中获取 SBJSON connectionDidFinishLoading 方法

objective-c - NSOperationQueue 完成

ios - 如何在使用 ARC 的项目中释放 'request'?

iphone - 如何可靠地管理后台请求?

ios - 如何检查 NSDictionary 键值是否为空?