4
我正在使用AFNetworking将大文件下载到我的iPad应用程序中。AFNetworking不恢复下载
AFHTTPRequestOperation的一个实例用于下载此文件。下面是引用代码 -
//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];
现在,这里的问题是,当我尝试暂停使用下面的功能恢复此下载后,pauseDownload功能的正常不过的简历下载不起作用的方式应该和似乎下载从一开始就开始,因为我期待它会从它离开的地方恢复。这可能是一个问题?
-(void)pauseDownload{ [operation pause]; } -(void)resumeDownload{ [operation resume]; }
当应用程序已退出并重新启动时,这也起作用吗? – openfrog
@openfrog是的,它也适用于应用程序已退出并重新启动 –
可以请你帮我在这 [self enqueueHTTPRequestOperation:operation]; –