I am using AFNetworking to download large file into my iPad app.
An instance of AFHTTPRequestOperation is used to download this file. Below is the code for reference -
//request is the NSRequest object for the file getting downloaded AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *operation, id responseObject) { } failure:^(AFHTTPRequestOperation *operation, NSError *error) { }]; //here path variable is the location where file would be placed on download operation.outputStream = [NSOutputStream outputStreamToFileAtPath:path append:YES]; //since this class is subclass of AFHTTPClient so the operation is added to request queue [self enqueueHTTPRequestOperation:operation];
Now the issue here is that when i try pause and resume this download using below functions, the pauseDownload function works properly however the resume download doesn't work the way it should and it seems like the download starts from the beginning where as I was expecting that it will resume from the place it left. What could be an issue here?
-(void)pauseDownload{ [operation pause]; } -(void)resumeDownload{ [operation resume]; }See Question&Answers more detail:os