尝试使用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);
答案 0 :(得分:3)
断言上方有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]
应该这样做。