iphoneobjective-cthree20

TTRequestLoader max content size issue


I'm getting these errors when trying to load big files using TTRequestLoader:

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

Is there a function to increase the size of the files loaded by TTURLRequest, in order to aviod these errors?

My code:

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);

Solution

  • The assertion has the following comment above it:

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

    So calling [[TTURLRequestQueue mainQueue] setMaxContentLength:0] should do it.