GTM does not support resuming from broken download.
We use the following steps to resume from broken download:
1.Set Range header for request
2.set NSFileHandle of an existed temp file for GTMHttpFetcher
3.let GTMHttpFetcher download data directly into the NSFileHandle
But in GTMHttpFetcher.m:
- (void)connection:(NSURLConnection *)connection
didReceiveResponse:(NSURLResponse *)response {
@synchronized(self) {
// This method is called when the server has determined that it
// has enough information to create the NSURLResponse
// it can be called multiple times, for example in the case of a
// redirect, so each time we reset the data.
[downloadedData_ setLength:0];
//=======comment by yuleiming2009==========
//[downloadFileHandle_ truncateFileAtOffset:0];
downloadedLength_ = 0;
[self setResponse:response];
// Save cookies from the response
[self handleCookiesForResponse:response];
}
}
----------------------------
you can see that [downloadFileHandle_ truncateFileAtOffset:0]; is called which
makes resuming from broken download impossible.
Original issue reported on code.google.com by yuleimin...@gmail.com on 13 Aug 2013 at 5:58
Original issue reported on code.google.com by
yuleimin...@gmail.com
on 13 Aug 2013 at 5:58