【问题标题】:TTRequestLoader max content size issueTTRequestLoader 最大内容大小问题
【发布时间】:2011-06-30 11:59:21
【问题描述】:

我在尝试使用 TTRequestLoader 加载大文件时遇到这些错误:

2011-06-30 07:25:21.782 xxxxxxx[1261:607] -[TTRequestLoader connection:didReceiveResponse:](317):
 TTDASSERT failed: 0 == _queue.maxContentLength || contentLength <=_queue.maxContentLength

是否有增加 TTURLRequest 加载的文件大小的功能,以避免这些错误?

我的代码:

TTURLRequest* request = [TTURLRequest
                       requestWithURL: [_url absoluteString]
                       delegate: self];

request.cachePolicy = cachePolicy;
request.cacheExpirationAge = (60*60*24*3);

TTURLDataResponse* response = [[TTURLDataResponse alloc] init];
request.response = response;
TT_RELEASE_SAFELY(response);

【问题讨论】:

    标签: iphone objective-c three20


    【解决方案1】:

    断言上面有以下comment

    // If you hit this assertion it's because a massive file is about to be downloaded.
    // If you're sure you want to do this, add the following line to your app delegate startup
    // method. Setting the max content length to zero allows anything to go through. If you just
    // want to raise the limit, set it to any positive byte size.
    // [[TTURLRequestQueue mainQueue] setMaxContentLength:0]
    

    所以调用[[TTURLRequestQueue mainQueue] setMaxContentLength:0] 应该可以。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-06-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多