I am downloading a file from the server.
I can successfully upload the file. But whenever I cancel the download operation (in the interval) and restart the download. Download starts from the previous move (not from scratch). but I want to reload the boot from scratch.
Setup operation.deleteTempFileOnCancel = YES;also doesn't help
The file is not created on the specified destination path when I cancel the download between
operation.tempPath is returning null (not able to delete temporary file)
I am using the following code
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:model.downloadUrl]];
operation = [[AFDownloadRequestOperation alloc] initWithRequest:request targetPath:path shouldResume:YES];
operation.deleteTempFileOnCancel = YES;
[operation setProgressiveDownloadProgressBlock:^(AFDownloadRequestOperation *operation, NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpected, long long totalBytesReadForFile, long long totalBytesExpectedToReadForFile)
{
}
}];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject)
{
}
failure:^(AFHTTPRequestOperation *operation, NSError *error) {
}];
[operation start];
I want to start the download from scratch if the download is canceled between them and then restarted. I am using iOS 7
source
share